public static float GetEffective(ElementalTyping attack, ElementalTyping defend) { if (attack == ElementalTyping.None || defend == ElementalTyping.None) { return(1); } int row = (int)attack - 1; int col = (int)defend - 1; return(weaknessChart[row][col]); }
public static float GetEffective(ElementalTyping attack, ElementalTyping defend1, ElementalTyping defend2) { if (attack == ElementalTyping.None || defend1 == ElementalTyping.None && defend2 == ElementalTyping.None) { return(1); } int row = (int)attack - 1; int col = (int)defend1 - 1; float d1 = weaknessChart[row][col]; col = (int)defend2 - 1; float d2 = weaknessChart[row][col]; // Funny business to avoid returning 0 for damage calcs, in the case of single or double not effective. // Returns 2 instead of 2.25 if (d1 == se && d2 == se) { return(Mathf.FloorToInt(d1 * d2)); } return(d1 * d2); }