ID:2040142
 
Man undo. Feed me material.
What kind of discussion do you want to have here?


Why not. Jeez.
"casting a firestorm that incinerates mobs and burns turf "
Spell
var/atom/movable/owner
var/manaCost

Spell/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)


I have done a few things here slightly differently from what you would expect, and they have been on purpose. Feel free to ask.
Tell me more.
*1 HasMana is a procedure (previously defined) Its parameters include the Spellsz 'manaCost'; the owner is assigned to the verbsz user?

Notice how I defined the variable "owner" on line 2 of the code snippet. It is defined under /Spell, meaning that all sub-types of it (eg. /Spell/Firestorm) will also have it. I suppose you'd assign it in /Spell/New() or somewhere similar.

*3 I noticed you subtracted 'manaCost' using the AddMana procedure? (Your AddMana procedure operates by returning the specific spellsz manaCost) How?
Sorry, the proc name was misleading. Let's rename it, "ChangeMana".
The idea is that, instead of simply doing "owner.mana -= manaCost", you could put some juicy complexity into that by doing the following:
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


Notice how by creating a proc like this, it's easy to start adding effects and modifiers. This is a bit of a crude example, but you get the idea.

*4 The for loop checks all the turf within a fixed range from the 'owner' We could influence by skill level & strength of spell?
Just make them variables, and replace them in the proc! Variables are your friend.

//*6 They TakeDamage by owner, however much damage the procedure has calculated, what 'fire' was intended to do? I do not know?
Maybe you want different "damage types" to deal more or less damage to enemies. In games like Diablo, players have elemental resistances; this way, if a party of players know they are going to fight, say, Fire monsters in the next dungeon, they can prepare themselves by acquiring gear that gives them extra Fire resistance. I could write more pseudo code here, just to illustrate:
// Imagine the following variables are a number between 0 and 1, e.g. 0.45
mob/var
fireResistance, waterResistance

mob/proc/TakeDamage(attacker, amount, atkType)
/*
If fireResistance has a value of 0.75, that means it reduces
fire damage by 75%!

1. amount *= 1 - 0.75
2. 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)



I couldn't quite understand your other questions, sorry!
Thanks. Bye!
cool
thank
In response to Delta0Zero2
Delta0Zero2 wrote:
Thanks. Bye!

Hahaha this thread is adorable.
You probably just did this guys homework.
In response to Gunbuddy13
Gunbuddy13 wrote:
You probably just did this guys homework.

I got a more pornographic vibe, but yeah. That's a theory.
In response to Gunbuddy13
Gunbuddy13 wrote:
You probably just did this guys homework.

WEEEEEEW Gravedigger

Login to reply.