Beispiel #1
0
    public void FighterDies(AbstractFighter fighter, AbstractFighter killer)
    {
        int            fighterNum     = fighter.GetIntVar(TussleConstants.FighterVariableNames.PLAYER_NUM);
        FighterResults fighterResults = resultsDict[fighterNum];

        if (!BattleLoader.current_loader.stockInfinity)
        {
            fighterResults.stocks -= 1;
            if (fighterResults.stocks <= 0)
            {
                UnregisterObject(fighter.getBattleObject());
                //If there's one or less players left, end the battle
                if (fighters.Count <= 1)
                {
                    EndBattle();
                }
            }
            else
            {
                fighter.Respawn();
            }
        }
        fighterResults.falls += 1;
        fighterResults.score -= 1;

        //If the killer is null, it's a self destruct and we need to adjust the score as such
        if (killer == null)
        {
            fighterResults.score         -= 1;
            fighterResults.selfDestructs += 1;

            fighterResults.deathsAgainst[fighterNum] += 1;
            fighterResults.killsAgainst[fighterNum]  += 1;
        }
        else
        {
            int            killerNum     = killer.GetIntVar(TussleConstants.FighterVariableNames.PLAYER_NUM);
            FighterResults killerResults = resultsDict[killerNum];

            killerResults.score += 1;
            killerResults.killsAgainst[fighterNum]  += 1;
            fighterResults.deathsAgainst[killerNum] += 1;
        }
    }