クラス CombatSimulator
Responsibilities:
- Time progression —
advanceTime(double)ticks the event queue forward, firing registeredTimerEvents in chronological order. - Action execution —
performAction(String, AttackAction)resolves damage, applies elemental gauges, handles ICD, triggers reactions, and advances simulation time by the action's animation duration. - Buff lifecycle — team-wide and field-only
Buffs are collected and merged ingetApplicableBuffs(model.entity.Character)before each damage calculation. - Reaction hooks — elemental reactions are computed per hit; amplifying reactions modify the damage multiplier in-line while transformative reactions (Overload, Superconduct, Electro-Charged) produce independent damage instances.
- Moonsign system — custom Lunar mechanic tracked via the
CombatSimulator.Moonsignenum; whenCombatSimulator.Moonsign.ASCENDANT_GLEAMis active, non-Lunar characters triggerapplyAscendantBlessing(model.entity.Character)on Skill / Burst use.
Entry points create a CombatSimulator, call addCharacter(model.entity.Character) and
setEnemy(model.entity.Enemy), then drive a rotation by calling performAction(java.lang.String, java.lang.String) and
switchCharacter(java.lang.String) in sequence. After the rotation, getDPS() and
printReport() summarise results.
-
ネストされたクラスの概要
ネストされたクラス修飾子とタイプクラス説明static enumRepresents the global Moonsign state of the party, which governs Ascendant Blessing eligibility — a custom Lunar mechanic not present in the official game.static interfaceObserver interface for elemental reaction events. -
コンストラクタの概要
コンストラクタ -
メソッドの概要
修飾子とタイプメソッド説明voidaddCharacter(Character character) Adds a character to the party and initialises their energy to full.voidRegisters anActionListenerto be notified after eachperformAction(String, AttackAction)call.voidRegisters aParticleListenerto be notified when particles are generated.voidRegisters aCombatSimulator.ReactionListenerto be notified when any elemental reaction fires.voidadvanceTime(double duration) Advances simulation time bydurationseconds, firing any registeredTimerEvents whose tick time falls within the interval.voidapplyFieldBuff(Buff buff) Adds a buff to the field buff list.voidapplyTeamBuff(Buff buff) Adds a buff to the team buff list.voidapplyTeamBuffNoStack(Buff buff) Adds a buff to the team buff list, first removing any existing buff with the same name.Returns the character currently on-field.Collects all buffs that apply to the given character at the current simulation time.getCharacter(String name) Returns the party member with the given name, ornullif not found.doubleReturns the current simulation time in seconds.doublegetDPS()Returns total DPS over the rotation (totalDamage / rotationTime).getEnemy()Returns the enemy currently set on the simulator.Returns the current Moonsign state.Returns all characters in the party.doubleReturns the simulation time at the end of the last recorded action, used as the rotation duration denominator when computing DPS.Convenience method returning all buffs applicable to the currently active character.doubleReturns the cumulative damage dealt across all characters and reactions.booleanReturns whether console logging is currently enabled.booleanReturns whether the Thundercloud state (Lunar-Charged extension) is currently active.voidnotifyParticle(Element e, double count) Notifies all registeredParticleListeners that particles have been generated.voidnotifyReaction(ReactionResult result, Character trigger) Notifies all registeredCombatSimulator.ReactionListeners and all artifactonReactioncallbacks for every party member when a reaction has been triggered.voidperformAction(String charName, String actionKey) Triggers a named ability action (e.g.voidperformAction(String charName, AttackAction action) Executes anAttackActionfor the named character, then advances simulation time by the action's (ATK-SPD-adjusted) animation duration.voidperformActionWithoutTimeAdvance(String charName, AttackAction action) Resolves all damage and elemental effects of anAttackActionwithout advancing simulation time.voidPrints a formatted DPS breakdown table to standard output, showing each character's total damage, share percentage, and individual DPS over the rotation time.voidrecordDamage(String charName, double dmg) Accumulates damage into the per-character damage report and overall total.voidRegisters aTimerEventin the priority queue.voidsetActiveCharacter(String name) Immediately sets the active character without triggering swap callbacks, cooldowns, or time advancement.voidsetECTimerRunning(boolean running) Sets the EC timer running flag directly.voidSets the enemy that characters will attack during the simulation.voidsetLoggingEnabled(boolean enable) Enables or disables per-action console logging ([T=x.x]lines).voidDirectly sets the Moonsign state.voidswitchCharacter(String name) Switches the active character to the named party member, enforcing a 1.0-second swap cooldown between consecutive swaps.voidRecalculates and reapplies the Gleaming Moon Synergy buff based on the current presence of "Gleaming Moon: Intent" and "Gleaming Moon: Devotion" buffs on any party member.voidRecomputes theCombatSimulator.Moonsignstate from the current party composition and updates it accordingly.
-
コンストラクタの詳細
-
CombatSimulator
public CombatSimulator()Constructs a new simulator with an empty party and zeroed time.
-
-
メソッドの詳細
-
setLoggingEnabled
public void setLoggingEnabled(boolean enable) Enables or disables per-action console logging ([T=x.x]lines). Disable before optimisation runs to reduce output noise.- パラメータ:
enable-trueto enable logging
-
isLoggingEnabled
public boolean isLoggingEnabled()Returns whether console logging is currently enabled.- 戻り値:
trueif logging is on
-
setECTimerRunning
public void setECTimerRunning(boolean running) Sets the EC timer running flag directly. Used by the EC tick event to signal that the Electro-Charged DoT sequence has ended.- パラメータ:
running-trueif an EC tick timer is active
-
isThundercloudActive
public boolean isThundercloudActive()Returns whether the Thundercloud state (Lunar-Charged extension) is currently active. The Thundercloud persists for 6 seconds after the last Lunar-Charged trigger.- 戻り値:
trueif the current time is within the Thundercloud window
-
setEnemy
Sets the enemy that characters will attack during the simulation.- パラメータ:
enemy- theEnemyinstance
-
getEnemy
Returns the enemy currently set on the simulator.- 戻り値:
- the
Enemy, ornullif not yet assigned
-
addCharacter
Adds a character to the party and initialises their energy to full. The first character added automatically becomes the active character.- パラメータ:
character- theCharacterto add
-
getCharacter
Returns the party member with the given name, ornullif not found.- パラメータ:
name- the character's registered name- 戻り値:
- the matching
Character
-
getPartyMembers
Returns all characters in the party.- 戻り値:
- collection of all
Characterobjects
-
getActiveCharacter
Returns the character currently on-field.- 戻り値:
- the active
Character
-
switchCharacter
Switches the active character to the named party member, enforcing a 1.0-second swap cooldown between consecutive swaps.Sequence of events:
- If the swap cooldown has not elapsed,
advanceTime(double)is called to reach it. onSwitchOutand artifactonSwitchOutcallbacks fire for the outgoing character.- The new character becomes active and artifact
onSwitchIncallbacks fire. - A 0.1-second swap delay is applied via
advanceTime(double). - The swap is logged to the
VisualLoggertimeline.
- パラメータ:
name- the name of the character to switch to
- If the swap cooldown has not elapsed,
-
setActiveCharacter
Immediately sets the active character without triggering swap callbacks, cooldowns, or time advancement. Intended for RL optimisation initialisation only.- パラメータ:
name- the name of the character to set as active
-
getCurrentTime
public double getCurrentTime()Returns the current simulation time in seconds.- 戻り値:
- current time
-
applyTeamBuff
Adds a buff to the team buff list. The buff is considered for all party members duringgetApplicableBuffs(model.entity.Character).- パラメータ:
buff- theBuffto add
-
applyTeamBuffNoStack
Adds a buff to the team buff list, first removing any existing buff with the same name. Prevents stacking of effects that should not accumulate (e.g. refreshable buffs).- パラメータ:
buff- theBuffto apply without stacking
-
applyFieldBuff
Adds a buff to the field buff list. Field buffs are only applied to the currently active (on-field) character duringgetApplicableBuffs(model.entity.Character).- パラメータ:
buff- theBuffto restrict to the on-field character
-
getApplicableBuffs
Collects all buffs that apply to the given character at the current simulation time.Sources aggregated (in order):
- Team buffs whose
appliesToCharacterpredicate matches. - Weapon team buffs from every party member's weapon.
- Character passive team buffs from every party member.
- Field buffs, only if
cis the active character.
- パラメータ:
c- the character to collect buffs for- 戻り値:
- list of applicable
Buffobjects (may include expired buffs; callers should filter withBuff#isExpired)
- Team buffs whose
-
setMoonsign
Directly sets the Moonsign state. PreferupdateMoonsign()to derive the correct state from the current party composition.- パラメータ:
sign- the newCombatSimulator.Moonsignstate
-
getMoonsign
Returns the current Moonsign state.- 戻り値:
- the active
CombatSimulator.Moonsign
-
getTeamBuffs
Convenience method returning all buffs applicable to the currently active character. Delegates togetApplicableBuffs(Character).- 戻り値:
- list of buffs for the active character
-
performAction
Triggers a named ability action (e.g."skill"or"burst") for a character, waiting out any remaining cooldown before executing.For
"skill"/"E"actions the skill cooldown is enforced; for"burst"/"Q"actions the burst cooldown is enforced and an energy warning is printed if the character lacks sufficient energy. After cooldown resolution, the character'sonActioncallback and weapononActionpassive are invoked.- パラメータ:
charName- the name of the character performing the actionactionKey- the action key string (e.g."skill","burst","E","Q")- 例外:
RuntimeException- if no character withcharNameexists in the party
-
recordDamage
Accumulates damage into the per-character damage report and overall total. Called internally after each damage calculation and reaction damage instance.- パラメータ:
charName- the name to attribute the damage todmg- the damage amount to record
-
getRotationTime
public double getRotationTime()Returns the simulation time at the end of the last recorded action, used as the rotation duration denominator when computing DPS.- 戻り値:
- rotation end time in seconds
-
printReport
public void printReport()Prints a formatted DPS breakdown table to standard output, showing each character's total damage, share percentage, and individual DPS over the rotation time. -
getDPS
public double getDPS()Returns total DPS over the rotation (totalDamage / rotationTime). Returns0.0if no time has elapsed.- 戻り値:
- DPS value
-
getTotalDamage
public double getTotalDamage()Returns the cumulative damage dealt across all characters and reactions.- 戻り値:
- total damage
-
registerEvent
Registers aTimerEventin the priority queue. The event will fire whenadvanceTime(double)advances past itsTimerEvent.getNextTickTime().- パラメータ:
e- the event to register
-
advanceTime
public void advanceTime(double duration) Advances simulation time bydurationseconds, firing any registeredTimerEvents whose tick time falls within the interval.Events are processed in chronological order; after each tick the event is re-queued unless
TimerEvent.isFinished(double)returnstrue. After all events in the window have fired,currentTimeis set tocurrentTime + durationandrotationTimeis updated.- パラメータ:
duration- the number of seconds to advance
-
addListener
Registers anActionListenerto be notified after eachperformAction(String, AttackAction)call.- パラメータ:
l- the listener to add
-
addParticleListener
Registers aParticleListenerto be notified when particles are generated.- パラメータ:
l- the listener to add
-
notifyParticle
Notifies all registeredParticleListeners that particles have been generated. Called by character skill/burst implementations after emitting particles.- パラメータ:
e- the element of the particlescount- the number of particles generated
-
addReactionListener
Registers aCombatSimulator.ReactionListenerto be notified when any elemental reaction fires.- パラメータ:
l- the listener to add
-
notifyReaction
Notifies all registeredCombatSimulator.ReactionListeners and all artifactonReactioncallbacks for every party member when a reaction has been triggered.- パラメータ:
result- the reaction resulttrigger- the character whose element triggered the reaction
-
updateGleamingMoonSynergy
public void updateGleamingMoonSynergy()Recalculates and reapplies the Gleaming Moon Synergy buff based on the current presence of "Gleaming Moon: Intent" and "Gleaming Moon: Devotion" buffs on any party member. Each unique effect present contributes +10% to Lunar Charged, Bloom, and Crystallize DMG Bonus. The resulting synergy buff is applied to all party members for 8 seconds.This method should be called after a damage or reaction event that might have changed the count of active Gleaming Moon effects.
-
updateMoonsign
public void updateMoonsign()Recomputes theCombatSimulator.Moonsignstate from the current party composition and updates it accordingly.- 0 Lunar characters →
CombatSimulator.Moonsign.NONE - 1 Lunar character →
CombatSimulator.Moonsign.NASCENT_GLEAM - 2+ Lunar characters →
CombatSimulator.Moonsign.ASCENDANT_GLEAM
addCharacter(model.entity.Character). - 0 Lunar characters →
-
performAction
Executes anAttackActionfor the named character, then advances simulation time by the action's (ATK-SPD-adjusted) animation duration.In addition to the steps in
performActionWithoutTimeAdvance(java.lang.String, simulation.action.AttackAction):- If
CombatSimulator.Moonsign.ASCENDANT_GLEAMis active and the acting character is non-Lunar and uses a SKILL or BURST,applyAscendantBlessing(model.entity.Character)fires. - All registered
ActionListeners are notified. - For NORMAL and CHARGE actions, ATK SPD from buffs shortens the animation.
- パラメータ:
charName- the name of the character performing the actionaction- theAttackActionto execute- 例外:
RuntimeException- if no character withcharNameexists in the party
- If
-
performActionWithoutTimeAdvance
Resolves all damage and elemental effects of anAttackActionwithout advancing simulation time. Used for periodic events (e.g. DoT ticks viaPeriodicDamageEvent) where time is already managed by the event queue.Steps executed:
- ICD check via
ICDManager; element application proceeds only if ICD permits. - If
AttackAction.isLunarConsidered(), a synthetic Lunar reaction event is fired. - Elemental gauge is checked against active auras; reactions are computed and transformative damage instances (Overload, EC, Superconduct, Swirl) are dealt.
- Amplifying reactions set a multiplier applied in
DamageCalculator. - Standard action damage is calculated via
DamageCalculator.calculateDamage. - Weapon
onDamageand artifactonDamagehooks are invoked. - The hit is logged to
VisualLogger.
- パラメータ:
charName- the name of the character performing the actionaction- theAttackActionto resolve- 例外:
RuntimeException- if no character withcharNameexists in the party
- ICD check via
-