Beispiel #1
0
    void BasicCombat()
    {
        // DPS stage
        // Boss applies AoE damage within 5-20 to the dps and healer players
        boss.ApplyAoE(nonTanks);
        totalDamageDoneToParty += boss.GetLastAoEDealt(); // log aoe damage dealt to players

        // Boss deals regular damage within 45-55 to the tank
        boss.AttackTarget(warrior);
        totalDamageDoneToParty += boss.GetLastDamageDealt(); // log damage dealt to tank

        foreach (Unit player in players)
        {
            // DPS players and tank all damage boss
            if (player.CanAttack())
            {
                DPS dps = player.GetComponent <DPS>();
                dps.AttackTarget(boss);
                totalDamageDoneToBoss += dps.GetLastDamageDealt(); // log damage dealt to boss
            }
        }

        // Healing stage
        {
            Healer priestHealer = priest.GetComponent <Healer>();

            // Cast BigHeal on the tank
            priestHealer.BigHeal(warrior);

            float rand = Random.value;
            if (rand <= 0.2) // priest has 20% chance of casting small heal on itself
            {
                priestHealer.SmallHeal(priest);
            }
            else if (rand <= 0.3) // priest has 10% chance of casting small heal on others
            {
                // Randomly select non-tank player
                int index = Random.Range(0, 4);

                // Then cast small heal on them
                priestHealer.SmallHeal(nonTanks[index]);
            }
        }

        // The priest regenerates 2 mana per second
        priest.RegenerateMana(2);
    }