パッケージ mechanics.buff

クラス SimpleBuff

java.lang.Object
mechanics.buff.Buff
mechanics.buff.SimpleBuff

public class SimpleBuff extends Buff
A concrete Buff implementation that delegates stat application to a Consumer<StatsContainer> lambda.

Use SimpleBuff when the buff effect can be expressed as a single lambda, for example:

   new SimpleBuff("Bennett Q ATK", 12.0, sim.getCurrentTime(),
       s -> s.add(StatType.ATK_FLAT, bonus));
 
  • コンストラクタの詳細

    • SimpleBuff

      public SimpleBuff(String name, double duration, double currentTime, Consumer<StatsContainer> effect)
      Creates a time-limited buff whose effect is provided as a lambda.
      パラメータ:
      name - display name used for logging and de-duplication
      duration - how long the buff lasts in simulation seconds
      currentTime - simulation time at which the buff starts
      effect - lambda that writes stat bonuses into the provided container
  • メソッドの詳細

    • applyStats

      protected void applyStats(StatsContainer stats, double currentTime)
      Invokes the stored effect lambda to apply stat bonuses, if the effect is non-null.
      定義:
      applyStats クラス内 Buff
      パラメータ:
      stats - the stats container to modify
      currentTime - current simulation time in seconds (unused by this implementation)