コード例 #1
0
        public static int Damage(Move usedMove, Battle attacker, Mon attackerMon, Mon defenderMon)
        {
            double damage = (double)Battle.BaseDamage(attacker.GetBattleId(), usedMove) * (double)Battle.CritMultiplier() * (double)MonType.STABMultiplier(attackerMon, usedMove) * (double)usedMove.AccuracyMultiplier();

            return((int)damage);
            // (double)MonType.TypeMultiplier(defenderMon, usedMove)
        }
コード例 #2
0
 public override bool Equals(System.Object otherBattle)
 {
     if (!(otherBattle is Battle))
     {
         return(false);
     }
     else
     {
         Battle newBattle              = (Battle)otherBattle;
         bool   idEquality             = this.GetBattleId().Equals(newBattle.GetBattleId());
         bool   mon_idEquality         = this.GetMon_Id().Equals(newBattle.GetMon_Id());
         bool   nameEquality           = this.GetBattleName().Equals(newBattle.GetBattleName());
         bool   levelEquality          = this.GetLevel().Equals(newBattle.GetLevel());
         bool   totalHitpointsEquality = this.GetTotalHitpoints().Equals(newBattle.GetTotalHitpoints());
         bool   lastHitpointsEquality  = this.GetLastHitpoints().Equals(newBattle.GetLastHitpoints());
         bool   hitpointsEquality      = this.GetHitpoints().Equals(newBattle.GetHitpoints());
         bool   attackEquality         = this.GetAttack().Equals(newBattle.GetAttack());
         bool   defenseEquality        = this.GetDefense().Equals(newBattle.GetDefense());
         bool   spattackEquality       = this.GetSpecialattack().Equals(newBattle.GetSpecialattack());
         bool   spdefenseEquality      = this.GetSpecialdefense().Equals(newBattle.GetSpecialdefense());
         bool   speedEquality          = this.GetSpeed().Equals(newBattle.GetSpeed());
         bool   pp1Equality            = this.GetMove1pp().Equals(newBattle.GetMove1pp());
         bool   pp2Equality            = this.GetMove2pp().Equals(newBattle.GetMove2pp());
         bool   pp3Equality            = this.GetMove3pp().Equals(newBattle.GetMove3pp());
         bool   pp4Equality            = this.GetMove4pp().Equals(newBattle.GetMove4pp());
         bool   playerEquality         = this.GetIsPlayer().Equals(newBattle.GetIsPlayer());
         bool   computerEquality       = this.GetIsComputer().Equals(newBattle.GetIsComputer());
         bool   activeEquality         = this.GetIsActive().Equals(newBattle.GetIsActive());
         return(idEquality && mon_idEquality && nameEquality && levelEquality && totalHitpointsEquality && hitpointsEquality && attackEquality && defenseEquality && spattackEquality && spdefenseEquality && speedEquality && pp1Equality && pp2Equality && pp3Equality && pp4Equality && playerEquality && computerEquality && activeEquality);
     }
 }
コード例 #3
0
        public static void Sequence(int id)
        {
            Battle      player        = Battle.FindPlayer();
            Battle      computer      = Battle.FindComputer();
            Mon         playerMon     = Mon.Find(player.GetMon_Id());
            Mon         computerMon   = Mon.Find(computer.GetMon_Id());
            Move        playerMove    = Move.Find(id);
            List <Move> computerMoves = Mon.Find(computer.GetMon_Id()).GetMoves();
            Random      move          = new Random();
            Move        computerMove  = computerMoves[move.Next(computerMoves.Count)];

            //Speed Check
            int tie = 0;

            if (computer.GetSpeed() == player.GetSpeed())
            {
                Random speedTie = new Random();
                tie = speedTie.Next(1, 3);
            }
            if (player.GetSpeed() > computer.GetSpeed() || tie == 1)
            {
                double newHP   = (double)computer.GetHitpoints() - (double)Battle.BaseDamage(player.GetBattleId(), playerMove) * (double)MonType.TypeMultiplier(computerMon, playerMove) * (double)MonType.STABMultiplier(playerMon, playerMove) * (double)playerMove.AccuracyMultiplier() * (double)Battle.CritMultiplier();
                int    roundHP = (int)newHP;
                if (roundHP > 0)
                {
                    computer.SetNewHP(roundHP);
                    double otherHP      = (double)player.GetHitpoints() - (double)Battle.BaseDamage(player.GetBattleId(), computerMove) * (double)MonType.TypeMultiplier(playerMon, computerMove) * (double)MonType.STABMultiplier(computerMon, computerMove) * (double)computerMove.AccuracyMultiplier() * (double)Battle.CritMultiplier();
                    int    roundOtherHP = (int)otherHP;

                    if (roundOtherHP > 0)
                    {
                        player.SetNewHP(roundOtherHP);
                    }
                    else
                    {
                        player.SetNewHP(0);
                    }
                }
                else
                {
                    computer.SetNewHP(0);
                }
            }
            else if (player.GetSpeed() < computer.GetSpeed() || tie == 2)
            {
                double otherHP      = (double)player.GetHitpoints() - (double)Battle.BaseDamage(computer.GetBattleId(), computerMove) * (double)MonType.TypeMultiplier(playerMon, computerMove) * (double)MonType.STABMultiplier(playerMon, playerMove) * (double)playerMove.AccuracyMultiplier() * (double)Battle.CritMultiplier();
                int    roundOtherHP = (int)otherHP;

                if (roundOtherHP > 0)
                {
                    player.SetNewHP(roundOtherHP);
                    double newHP   = (double)computer.GetHitpoints() - (double)Battle.BaseDamage(player.GetBattleId(), playerMove) * (double)MonType.TypeMultiplier(computerMon, playerMove) * (double)MonType.STABMultiplier(computerMon, computerMove) * (double)computerMove.AccuracyMultiplier();
                    int    roundHP = (int)newHP;
                    if (roundHP > 0)
                    {
                        computer.SetNewHP(roundHP);
                    }
                    else
                    {
                        computer.SetNewHP(0);
                    }
                }
                else
                {
                    player.SetNewHP(0);
                }
            }
        }