public override void PerformAction(ICharacter user, ICombatReader combat) { if (Target != null && !Target.IsDead()) { Target.ApplyBuff(new DefendBuff(new WeakReference <ICharacter>(user))); } }
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); }
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); }
public CombatActionEvent(ICombatReader combat, ICharacter target, ICharacter actionDoer, ICharacterAction action) : base(combat) { this.target = target; this.actionDoer = actionDoer; this.action = action; }
public CombatStartedEvent(ICombatReader combat) : base(combat) { }
public CombatUpdateEvent(ICombatReader combat) { this.combat = combat; }
public CombatantDied(ICombatReader combat, ICharacter victim) : base(combat) { this.victim = victim; }
public CombatEndedEvent(ICombatReader combat, CombatResult result) { this.combat = combat; this.result = result; }
public override void PerformAction(List <ICharacter> enemies, ICombatReader combat) { IncrementActions(combat); }