Tutorial

The Samurai class is intended to represent a samurai player in combat. Features include:

It does not include:

Usage

To use this class, first you must import the class from its module and then create an instance of it:

from samurai import Samurai

my_first_samurai = Samurai()

There are a number of keyword arguments that may be used to modify the initial state of the Samurai instance.

my_first_samurai = Samurai(base_gcd=2.40, kenki_mastery=0, kenki_gauge=0)

Samurai.base_gcd is set as 2.40s by default. Samurai.kenki_mastery is set to 0 by default, meaning no Kenki Mastery trait is active. Values of 1 and 2 correspond to the Mastery I and II traits, respectively. Note that these two attributes may only be set upon initialization and cannot be changed.

Samurai.kenki_gauge is set to 0 initially be default but may be set to a valid amount upon initialization or anytime afterwards.

After initialization, other initial conditions may be set prior to simulated combat. For example, to use Meikyo Shisui before the encounter starts:

my_first_samurai = Samurai(kenki_mastery=2)
my_first_samurai.meikyo_shisui()

This will trigger the effect of Samurai.meikyo_shisui(). To simulate the slashing resistance debuff being already applied:

my_first_samurai.applied_yukikaze = True

The heart of this simulation tool is the Samurai.parse_rotation() class method. This method takes an input list of tuples describing the rotation to be simulated and tracks buffs/debuffs, Kenki, Sen, and output potency over time. It may be used to simulate against single or multiple targets. For example, to simulate the Gekko combo against a single target:

my_first_samurai = Samurai(kenki_mastery=2)

action_list = [('Hakaze'), ('Jinpu'), ('Gekko')]

out_dataframe, out_avg_potency, out_potency_ps = my_first_samurai.parse_rotation(action_list)

The method output consists of a Pandas DataFrame object describing the simulated rotation, the average potency per GCD, and the average potency per second. The output DataFrame is compatible with the included visualization utilities in plotting but is also viewable just by using print() or display() in Jupyter notebooks.

The action list provided to the parse_rotation() method consists of tuples with the format:

[(weaponskill_1, ability_1a, ability_1b), ..., (weaponskill_N, ability_N)]

where the weaponskills and abilities are provided as strings. The abilities are considered to be used during the GCD of the corresponding weaponskill. An ability does not have to be provided. Here is an example of simulating a scenario with multiple targets:

n_targets = 5
my_first_samurai = Samurai(kenki_mastery=2, n_targets=n_targets)

action_list = [('Fuga'), ('Oka'), ('Fuga'), ('Mangetsu', 'Hissatsu: Kaiten'), ('Tenka Goken')]

out_dataframe, out_avg_potency, out_potency_ps = my_first_samurai.parse_rotation(action_list)