Python Class Pokemon Battle

Hey stackoverflow users,

I am trying to write a Python class for a pokemon battle. I followed the posts here, but I am trying to integrate the different pokemon typing. For instance, fire, grass, and water and allow them to function as they do in the game. For example, fire is super effective against grass. I am not sure if I should add in another function for type or define the typing within the constructor and write a series of nesting statements that determine effectiveness or ineffectiveness.

class Pokemon(object):
def __init__(self, name, HP, Damage, type):
self.name = name #Sets the name of the Pokemon
self.HP = HP #The Hit Points or health of this pokemon
self.Damage = Damage #The amount of Damage this pokemon does every attack
self.type = type #Determines the type of the pokmeon to factor in effectiveness

creates a nested dictionary for the weaknesses when the first type attacks. You can then access the multiplier for a fire type attacking a grass type like this:

attacking['fire']['grass'] # yields 2.0

As a side note: you are overwriting the damage of the Pokemon with this instruction: self.Damage = self.Damage * 1.35. This works as long as you don't have e.g. Squirtle battle first a Bulbasaur, then a ground-type Pokemon, against which Squirtle has the effectiveness 1. As soon as you'd start the battle against the Charmander, the damage of the Squirtle will be 5*2.0*1.0 = 10.0, which is not equal to the damage it should deal (5.0). If you created a new variable (turnDamage = self.Damage * attack[self.type][Opponent.type], this would not be a problem.