public static double TypeMultiplier(Mon defendingMon, Move attackingMove) { Dictionary <int, double> multiplier = new Dictionary <int, double>() { { 0, 1 }, { 1, 2 }, { 2, 0.5 }, { 3, 0 } }; MonType attackType = attackingMove.GetMonType(); List <MonType> types = defendingMon.GetMonTypes(); double multiply = 1; foreach (MonType type in types) { Dictionary <string, int> typeCompare = new Dictionary <string, int>() { { "fairy", type.GetFairy() }, { "steel", type.GetSteel() }, { "dark", type.GetDark() }, { "dragon", type.GetDragon() }, { "ghost", type.GetGhost() }, { "rock", type.GetRock() }, { "bug", type.GetBug() }, { "psychic", type.GetPsychic() }, { "flying", type.GetFlying() }, { "ground", type.GetGround() }, { "poison", type.GetPoison() }, { "fighting", type.GetFighting() }, { "ice", type.GetIce() }, { "grass", type.GetGrass() }, { "electric", type.GetElectric() }, { "water", type.GetWater() }, { "fire", type.GetFire() }, { "normal", type.GetNormal() }, }; double newMultiplier = multiplier[typeCompare[attackType.GetMonTypeName()]]; multiply = multiply * newMultiplier; } if (multiply > 1) { Message newMessage = new Message("<span class='animated jackInTheBox'>It's Super Effective!</span>"); newMessage.Save(); } else if (multiply < 1) { Message newMessage = new Message("<span class='animated slideInDown'>It's Not Very Effective...</span>"); newMessage.Save(); } return(multiply); }
public static double STABMultiplier(Mon attackingMon, Move attackingMove) { List <MonType> monType = attackingMon.GetMonTypes(); MonType attackType = attackingMove.GetMonType(); double multiply = 1; foreach (MonType type in monType) { if (type.GetMonTypeName().Equals(attackType.GetMonTypeName())) { multiply = multiply * 1.5; } } return(multiply); }