コード例 #1
0
ファイル: Army.cs プロジェクト: LeSphax/Famine
    /**
     * Each army inflict his damages on the other, the attackers hit first
     * Return -1 if the defenders lost
     * Return 1 if the attackers lost
     * Return 0 if the battle isn't over yet
     **/
    public static int Fight(Army defenders, Army attackers)
    {
        if (!defenders.TakeDamage(attackers.InflictDamages()))
        {
            return -1;
        }

        if (!attackers.TakeDamage(defenders.InflictDamages()))
        {
            return 1;
        }
        return 0;
    }