Comparing DamageType classes for damage calculation

Image below. There’s gotta be a better way to do this right?

The closest analogue to what I’m trying to do is create a rock, paper, scissors damage system a la Pokemon. Fire is weak to water, etc.

I have each TurnBasedCharacter sending it’s current “SelfDamageType” through the ApplyDamage function. On the Event AnyDamage I compare the SENDERs and the RECEIVERs DamageTypes.

I wanna keep this on my TurnBaseCharacter parent that way all the children inherit this functionality. At this point I’m thinking it might be easier to create “type” children and override the damage logic within them…

Thanks for any help.

First I’m going to assume the thing you want to know if your SelfDamageType is weak against the incoming damage type

One way to do something like this is:

  • Create a new DataAssetType by creating a new Blueprint that inherets from PrimaryDataAsset, lets call it DamageSettings
  • In DamageSettings you add a new Variable of type DamageType->ClassReference Map with value also DamageType->ClassReference


  • The map will hold information about which type is weak against which other type
  • Add a function in DamageSettings which takes two parameters as input of type DamageType->ClassReference IncomingDamage and SelfDamage, use the SelfDamage to get the damage it’s weak against out of the map and return a bool of the result of comparing the damage that it’s weak against with the incoming damage

  • Create a new DataAsset out of your newly defined DataAssetType (Miscellaneous->DataAsset, Select DamageSettings)
  • Setup your damage type weaknesses to each other, later you can add more if you create more

  • In your actor add a variable of type DamageSettings->ObjectRefference and link your data asset to it
  • In the damage function use the data asset object reference by calling the function you created on it

easy peasy, lemon squeezy

  • DataDriven design is always a win

[GitRepo][5] with example if you need it

I knew there had to be a way that is less…object oriented. Thank you for the guidance! Should help me think in a more data driven way from now on.