Example #1
0
    public virtual bool DoAttack(ICombatant target, AttackType type = AttackType.Kill)
    {
        if (target.Defenseless || RollDice(this.KillChance))
        {
            if (target.TrySave(this))
            {
                target.DoOnBlock(this);
            }
            else
            {
                switch (type)
                {
                    case AttackType.Freeze:
                        target.Freeze(this);
                        if (target is Combatant)
                            (target as Combatant).AddEffect(this.FreezeEffect.Clone());
                        break;
                    case AttackType.Lag:
                        target.Lag(this);
                        if (target is Combatant)
                            (target as Combatant).AddEffect(this.LagEffect.Clone());
                        break;
                    default:
                        //this reads backwards
                        //it's actually "kill the target, this is who killed the target"
                        target.Kill(this);
                        break;
                }

            }

            return true;
        }
        return false;
    }