void ActivateEnemy() { int playerIndex = FindPlayer("Enemy"); //If enemy exists, it attacks another random player if (playerIndex.IsFound() && players.Count > 1) { int atkIndex = FindPlayer("Enemy"); int defIndex; do { defIndex = random.Next(players.Count); }while (defIndex == atkIndex); int damage = (int)(random.Next((int)(players[atkIndex].Attack / 2), players[atkIndex].Attack) / 1 + players[defIndex].Defence); players[atkIndex].AttacksMade++; players[atkIndex].DamageDone += damage; players[defIndex].Health -= damage; players[defIndex].DamageTaken += damage; Output($"**【{players[atkIndex].PetName}】** performs {Discorgi.RandomAttack()} dealing {damage} damage to **【{players[defIndex].PetName}】**"); if (players[defIndex].Health <= 0) { Output($"**【{ players[defIndex].PetName}】** has died."); players[atkIndex].Kills++; players.RemoveAt(defIndex); } } }
void Attack() { if (ValidTarget()) { int atkIndex = FindPlayer(input.User); int defIndex = FindPlayer(input.Parameter); if (atkIndex != defIndex) { if (players[atkIndex].Energy > 0) { int damage = (int)(random.Next((int)(players[atkIndex].Attack / 2), players[atkIndex].Attack) / 1 + players[defIndex].Defence); players[atkIndex].Energy--; players[atkIndex].AttacksMade++; players[atkIndex].DamageDone += damage; if (players[atkIndex].AddExp(2)) { Output($"**【{players[atkIndex].PetName}】** has reached level {players[atkIndex].Level}!"); } players[defIndex].Health -= damage; players[defIndex].DamageTaken += damage; Output($"**【{players[atkIndex].PetName}】** performs {Discorgi.RandomAttack()} dealing {damage} damage to **【{players[defIndex].PetName}】**"); if (players[defIndex].Health <= 0) { Output($"**【{ players[defIndex].PetName}】** has died."); players[atkIndex].Kills++; if (players[atkIndex].AddExp(13)) { Output($"**【{players[atkIndex].PetName}】** has reached level {players[atkIndex].Level}!"); } players.RemoveAt(defIndex); } } else { Output($"**【{players[atkIndex].PetName}】** is too tired."); } } else { Output($"**【{players[atkIndex].PetName}】** chases his tail."); } } }
void CreateDiscorgi() { int playerIndex = FindPlayer(input.User); if (!playerIndex.IsFound()) { Discorgi player = new Discorgi(input.User, input.Parameter.Equals("") ? Discorgi.RandomName() : input.Parameter); players.Add(player); Output($"{input.User} captured a Discorgi wearing **{player.Accessory}** named **【{player.PetName}】**!"); } else { Output($"You already have **【{players[playerIndex].PetName}】**"); } }
void Heal() { if (ValidTarget()) { int atkIndex = FindPlayer(input.User); int defIndex = FindPlayer(input.Parameter); if (players[atkIndex].Energy > 0) { if (atkIndex != defIndex) { int healing = (int)(random.Next((int)(players[atkIndex].Attack / 2), players[atkIndex].Attack) * 1.5); players[atkIndex].Energy--; players[atkIndex].HealsMade++; players[atkIndex].HealingDone += healing; if (players[atkIndex].AddExp(1)) { Output($"**【{players[atkIndex].PetName}】** has reached level {players[atkIndex].Level}!"); } players[defIndex].Heal(healing); Output($"**【{players[atkIndex].PetName}】** performs {Discorgi.RandomHeal()} healing **【{players[defIndex].PetName}】** for {healing}"); } else { int healing = (int)(random.Next((int)(players[atkIndex].Attack / 2), players[atkIndex].Attack) * 0.7); players[atkIndex].Energy--; players[atkIndex].HealsMade++; players[atkIndex].HealingDone += healing; players[defIndex].Heal(healing); Output($"**【{players[atkIndex].PetName}】** performs {Discorgi.RandomHeal()} healing themself for {healing}"); } } else { Output($"**【{players[atkIndex].PetName}】** is too tired."); } } }
void CreateEnemy() { //Create Enemy if one does not exist int playerIndex = FindPlayer("Enemy"); if (!playerIndex.IsFound()) { Discorgi player = new Discorgi("Enemy", Discorgi.RandomEnemyName()); //LEVEL UP! int enemyLevel = random.Next(0, 5); for (int i = 0; i < enemyLevel; i++) { player.LevelUp(); } players.Add(player); Output($"A wild level {player.Level} **【{player.PetName}】** has appeared!"); } }