Advertisement
Tkap1

Untitled

Oct 17th, 2022
708
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.73 KB | None | 0 0
  1.  
  2. // this doesn't handle multiple instances of debuffs
  3. updateEnemy()
  4. {
  5.     if(enemy->storedBurn.base > 0)
  6.     {
  7.         enemy->currentHealth -= calculateStat(enemy->storedBurn);
  8.     }
  9.    
  10.     if(enemy->storedChill.base > 0)
  11.     {
  12.         enemy->movementSpeed *= 1.0f - calculateStat(enemy->storedChill);
  13.     }
  14. }
  15.  
  16. whenAttackHitsEnemy(...)
  17. {
  18.     if(attack->type == FIRE_ATTACK_TYPE)
  19.     {
  20.         enemy->storedBurn = attackSource.damageStat + attackSource.burnStat;
  21.         enemy->storedBurn.more *= BURN_DAMAGE_PERCENT_PER_SECOND;
  22.     }
  23.    
  24.     if(attack->type == COLD_ATTACK_TYPE)
  25.     {
  26.         // This assumes that damage doesn't affect chill effect
  27.         enemy->storedChill = attackSource.chillEffect;
  28.         enemy->storedChill.base += 1;
  29.         enemy->storedChill.more *= BASE_CHILL_EFFECT;
  30.     }
  31. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement