예제 #1
0
 public override void PerformAction(ICharacter user, ICombatReader combat)
 {
     if (Target != null && !Target.IsDead())
     {
         Target.ApplyBuff(new DefendBuff(new WeakReference <ICharacter>(user)));
     }
 }
예제 #2
0
 public override void PerformAction(ICharacter user, ICombatReader combat)
 {
     if (Target != null && !Target.IsDead())
     {
         var minDmg = Mathf.RoundToInt(Damage.MinimumDamage * user.Attributes.Attack);
         var maxDmg = Mathf.RoundToInt(Damage.MaximumDamage * user.Attributes.Attack);
         var dmg    = SingletonProvider.MainRandomProvider.RandomInt(minDmg, maxDmg);
         Target.BeAttacked(user, new AttackConfig(dmg));
         CentralEventPublisher.Instance.Publish(EventType.CombatAction, new CombatActionEvent(combat, Target, user, this));
     }
 }
    public override void StartChargingAction(ICharacter user, ICharacter target, ICombatReader combat)
    {
        var enemies = user.IsPlayer ? combat.GetEnemies() : combat.GetPlayers();

        if (enemies.Length == 0)
        {
            logger.Log("Unable to find a target to attack", LogLevel.Warning);
        }
        ICharacter actualTarget = enemies[SingletonProvider.MainRandomProvider.RandomInt(0, enemies.Length)];

        base.StartChargingAction(user, actualTarget, combat);
    }
예제 #4
0
 public override void PerformAction(List <ICharacter> enemies, ICombatReader combat)
 {
     if (possibleCharacterActions.TrueForAll(e => e.TurnProgress == null))
     {
         if (nextActionCooldown.IsDone())
         {
             StartChargingAction(possibleCharacterActions[0], null, combat);
             nextActionCooldown = new SimpleTimer(SingletonProvider.MainRandomProvider.RandomFloat(0.5f, 1.5f) + possibleCharacterActions[0].TurnProgress.TurnTime);
         }
     }
     IncrementActions(combat);
 }
예제 #5
0
 public CombatActionEvent(ICombatReader combat, ICharacter target, ICharacter actionDoer, ICharacterAction action) : base(combat)
 {
     this.target     = target;
     this.actionDoer = actionDoer;
     this.action     = action;
 }
예제 #6
0
 public CombatStartedEvent(ICombatReader combat) : base(combat)
 {
 }
예제 #7
0
 public CombatUpdateEvent(ICombatReader combat)
 {
     this.combat = combat;
 }
예제 #8
0
 public CombatantDied(ICombatReader combat, ICharacter victim) : base(combat)
 {
     this.victim = victim;
 }
예제 #9
0
 public CombatEndedEvent(ICombatReader combat, CombatResult result)
 {
     this.combat = combat;
     this.result = result;
 }
예제 #10
0
 public override void PerformAction(List <ICharacter> enemies, ICombatReader combat)
 {
     IncrementActions(combat);
 }