I want pseudocode man.
Spell var/atom/movable/owner var/manaCostSpell/Firestorm proc/Cast() if not owner.HasMana(manaCost) Sparks? Fizzling sound? idk owner.AddMana(-manaCost) for turf T in R range R of owner: if T.isFlammable then T.Burn(owner) for mob M in range R of owner: if not owner.AlliedWith(M) then M.TakeDamage(owner, damage, fire)
mob/proc/ChangeMana(var/amount) if(special item in inventory && amount < 0) amount /= 2 // Reduce the mana costs by half if(i am cursed && amount < 0) amount -= 10 // Increase all mana costs by 10 mana += amount // Positive values are added, negative values are subtracted! if(mana > maxMana) mana = maxMana else if(mana < 0) mana = 0
// Imagine the following variables are a number between 0 and 1, e.g. 0.45mob/var fireResistance, waterResistancemob/proc/TakeDamage(attacker, amount, atkType)/*If fireResistance has a value of 0.75, that means it reducesfire damage by 75%!1. amount *= 1 - 0.752. amount = amount * (1 - 0.75)3. amount = amount * 0.25*/ if (atkType is Fire) amount *= 1 - fireResistance else if (atkType is Water) amount *= 1 - waterResistance health -= abs(amount) // No need to take negative damage... maybe. Who knows, // we could even handle this like ChangeMana! if(health < 0) Die(attacker)
You probably just did this guys homework.
Login to reply.