ID:157573
 
How would I go about making a verb that, when used, adds buffs or debuffs to mobs in the Area of Effect?
for(var/mob/M in some_list_representing_the_area_maybe_oview())
apply_buff_or_debuff_to(M)
In response to Garthor
So I would put the code in a verb, change some_list to oview(5) or so, and apply_buff to my code for the buff or debuff?
In response to Tman1114
Yeah, pretty much.
In response to Garthor
Garthor wrote:
for(var/mob/M in some_list_representing_the_area_maybe_oview())
> apply_buff_or_debuff_to(M)


Although a good code, if what he is doing needs him to only give the buff to say, a teamate, you would go with something along these lines:
mob/var/team/list()
> mob/var/players/list()
//(Put a code to add and subtract players from the list)
> mob/verb/addteamate()
> var/M = input("Who do you want to add to your team?") in players
> usr.team += M
> mob/verb/buff()
> for(mob/M in oview(5))
> if(M in team)//not sure about that lol still working with lists myself, but you get the point
> M.stats += 1000

Sorry if you already knew that, just wanted to point it out for you in case.
In response to Albro1
And good code would not be directly modifying some variable but would be taking an object-oriented approach to maintaining buffs and debuffs.
In response to Garthor
Well, yes, but you see what I am getting at with that.
Use this:
mob/verb/buff()
var/mob/M
var/b_area = block(locate(src.x - 5, src.y - 5, src.z), locate(src.x + 5, src.y + 5, src.z)) //create a area
for(M in b_area)
M << "You are buffed" //here you put the code of the buff
In response to Twinsen99
Twinsen99 wrote:
Use this:

Yeah no, don't use that.
In response to Twinsen99
Ever heard of view()? What you posted is just stupid. Specially since block() returns a list of turfs, not mobs.
In response to Ruben7
Everybody is talking about the view (), and I gave an alternative ... but you already came stressed, messing me...

[Edit]
Try using this:
mob/verb/buff()
var/turf/T
var/b_lock = block(locate(x-2,y-2,z),locate(x+2,y+2,z))
for(T in b_lock)
for(var/mob/M in T)
M << "You receive a BUFF" // Change the code to the buff code
buff(M)

Only change the code off buff, and the locate of block...
In response to Twinsen99
Twinsen99 wrote:
Try using this:

No, don't. That code is horrible. Just stop trying to approximate help with your Bizarro-world outlook on programming.
In response to Albro1
Albro1 wrote:
Garthor wrote:
for(var/mob/M in some_list_representing_the_area_maybe_oview())
> > apply_buff_or_debuff_to(M)

Although a good code, if what he is doing needs him to only give the buff to say, a teamate, you would go with something along these lines:
mob/var/team/list()
> > mob/var/players/list()
> //(Put a code to add and subtract players from the list)
> > mob/verb/addteamate()
> > var/M = input("Who do you want to add to your team?") in players
> > usr.team += M
> > mob/verb/buff()
> > for(mob/M in oview(5))
> > if(M in team)//not sure about that lol still working with lists myself, but you get the point
> > M.stats += 1000

Sorry if you already knew that, just wanted to point it out for you in case.

Thanks, that was what I was looking for anyway, even though I didn't say.
In response to Popisfizzy
NOGROSS,PLEASE
In response to Twinsen99
In what world does that make any sense other than your own?