using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace Programmation_objet_TLESIO21.projet {
    public class GameManager {

        public static void AlterPokemonStat(String stat, double value, Pokemon p) {
            switch(stat) {
                case "PV":
                    p.setPV((int)Math.Floor(p.getPV() * value));
                    break;
                case "ATKPhys":
                    p.setATKPhys(((int)Math.Floor(p.getATKPhys() * value)));
                    break;
                case "ATKSpe":
                    p.setATKSpe(((int)Math.Floor(p.getATKSpe() * value)));
                    break;
                case "DEFPhys":
                    p.setDefPhys(((int)Math.Floor(p.getDEFPhys() * value)));
                    break;
                case "DEFSpe":
                    p.setDefSpe(((int)Math.Floor(p.getDEFSpe() * value)));
                    break;
                case "Speed":
                    p.setSpeed(((int)Math.Floor(p.getSpeed() * value)));
                    break;
                default:
                    break;

            }
        }

        public void ApplyNatureEffect(Enum nature, Pokemon p) {
            switch(nature) { //malus
                case Nature.BOLD:
                case Nature.CALM:
                case Nature.MODEST:
                case Nature.TIMID:
                    AlterPokemonStat("ATKPhys", 0.9, p);
                    break;
                case Nature.MILD:
                case Nature.GENTLE:
                case Nature.HASTY:
                case Nature.LONELY:
                    AlterPokemonStat("DEFPhys", 0.9, p);
                    break;
                case Nature.JOLLY:
                case Nature.IMPISH:
                case Nature.CAREFUL:
                case Nature.ADAMANT:
                    AlterPokemonStat("ATKSpe", 0.9, p);
                    break;
                case Nature.RASH:
                case Nature.LAX:
                case Nature.NAUGHTY:
                case Nature.NAIVE:
                    AlterPokemonStat("DEFSpe", 0.9, p);
                    break;
                case Nature.BRAVE:
                case Nature.QUIET:
                case Nature.SASSY:
                case Nature.RELAXED:
                    AlterPokemonStat("Speed", 0.9, p);
                    break;
                default:
                    break;
            }

            switch(nature) { //bonus
                case Nature.BRAVE:
                case Nature.NAUGHTY:
                case Nature.ADAMANT:
                case Nature.LONELY:
                    AlterPokemonStat("ATKPhys", 1.1, p);
                    break;
                case Nature.BOLD:
                case Nature.LAX:
                case Nature.IMPISH:
                case Nature.RELAXED:
                    AlterPokemonStat("DEFPhys", 1.1, p);
                    break;
                case Nature.QUIET:
                case Nature.MILD:
                case Nature.RASH:
                case Nature.MODEST:
                    AlterPokemonStat("ATKSpe", 1.1, p);
                    break;
                case Nature.CALM:
                case Nature.GENTLE:
                case Nature.SASSY:
                case Nature.CAREFUL:
                    AlterPokemonStat("DEFSpe", 1.1, p);
                    break;
                case Nature.JOLLY:
                case Nature.NAIVE:
                case Nature.HASTY:
                case Nature.TIMID:
                    AlterPokemonStat("Speed", 1.1, p);
                    break;
                default:
                    break;
            }
        }

        public void ApplyPlayerEffect(String playerName, Pokemon p) {
            switch(playerName) {
                case "Applejack":
                    AlterPokemonStat("PV", 0.95, p);
                    break;
                case "Rainbow Dash":
                    AlterPokemonStat("ATKPhys", 1.03, p);
                    break;
                case "Twilight Sparkle":
                    AlterPokemonStat("Speed", 1.07, p);
                    break;
                case "Pinkie Pie":
                    AlterPokemonStat("DEFPhys", 1.04, p);
                    break;
                case "Fluttershy":
                    AlterPokemonStat("DEFPhys", 0.96, p);
                    break;
                case "Izzy Moonbow":
                    AlterPokemonStat("PV", 1.05, p);
                    AlterPokemonStat("Speed", 0.95, p);
                    break;
                case "Zipp Storm":
                    AlterPokemonStat("PV", 0.95, p);
                    AlterPokemonStat("Speed", 1.05, p);
                    break;
                case "Sunny Starscout":
                    AlterPokemonStat("ATKSpe", 1.03, p);
                    break;
                case "Derpy Hooves":
                    AlterPokemonStat("PV", 0.95, p);
                    break;
                default:
                    break;
            }
        }


    }
}
