mob/var
list/abilities=list()
mob/proc/add_ability(var/i as num)
switch(i)
if("2")
src.abilities+="bash"
if("5")
src.abilities+="swing"
if("10")
src.abilities+="tackle"
mob/verb/test_abilities()//random example!
add_ability(src.lvl)
var/choose=input("Use which ability") in src.abilities
switch(choose)
if("bash")
//src.bash() attack
if("swing")
//src.swing() attack
if("tackle")
//src.tackle() attack
Problem description: The thing is I am not sure if using a switch statement for inside a text string inside a list is the best way to choose an ability from a list. I don't think having abilities as text strings in a list is so good. Maybe I should use a datum for this one? Btw, I haven't gotten the hang of datums yet.
Unlike this one where I use a proc using an object's use verb instead of a text string to check if the item is in the list as a text:
obj
verb/use(mob/m)
potion
name="Potion"
use(mob/m,mob/source)
var/HP=rand(10,100)
m.hp+=HP
m << "[source] used [name] on you to restore your hp by [HP]"
medicine
name="Medicine"
use(mob/m,mob/source)
m << "[source] used medicine on you"
mob/verb/use_item(mob/m in view(10))
var/obj/item=input("Which item use?") in src.contents
item.use(m)
How do you need to access the abilities?
How will you select them?
How will you execute them?