Skip to content

Instantly share code, notes, and snippets.

@YesIAmThatDan
Last active October 3, 2021 23:24
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save YesIAmThatDan/9bcdf2b09fa7f609f7d2e3b7f4adaace to your computer and use it in GitHub Desktop.
Save YesIAmThatDan/9bcdf2b09fa7f609f7d2e3b7f4adaace to your computer and use it in GitHub Desktop.
weapon weirdness
<object name="stick">
<inherit name="editor_object" />
<inherit name="wearable" />
<take />
<inventoryverbs type="stringlist">
<value>Look at</value>
<value>Drop</value>
</inventoryverbs>
<feature_wearable />
<attr name="wear_layer" type="int">1</attr>
<wear_slots type="stringlist">
<value>weapon</value>
</wear_slots>
<bonusatts>atk+1;agi-1</bonusatts>
<wearmsg>You wield the stick.</wearmsg>
<listalias>Stick</listalias>
<removeable />
<attr name="feature_switchable" type="boolean">false</attr>
<attr name="feature_startscript" type="boolean">false</attr>
<wear_adjverbs />
<displayverbs type="stringlist">
<value>Look at</value>
<value>Take</value>
</displayverbs>
<alias>Stick</alias>
<drop />
<takemsg>You pick it up and put it in your weapon pocket.</takemsg>
<usestandardverblist />
<look><![CDATA[What's brown and sticky and should be left on the ground?<br/>It gives +1 attack and -1 agility when wielded.]]></look>
<removemsg>You put the stick into your bag.</removemsg>
<onafterremove type="script">
weaponunequip (stick)
</onafterremove>
<onafterwear type="script">
player.attack = this.attack
</onafterwear>
<equip type="script">
WearGarment (this)
</equip>
<ontake type="script">
MoveObject (this, weapon pocket)
</ontake>
<ondrop type="script">
</ondrop>
<attack type="script"><![CDATA[
game.random = GetRandomInt(1,100 + player.agi)
OutputTextNoBr ("You swing the stick, ")
if (game.random <= 10) {
msg ("but you miss completely.<br/>")
player.damage = 0
}
else if (game.random <= 40) {
msg ("and manage to graze the monster.<br/>")
game.random1 = GetRandomInt(-2,-1)
player.damage = game.random1 + player.atk - battle room.def
if (player.damage < 1) {
player.damage = 1
}
battle room.health = battle room.health - player.damage
}
else if (game.random <= 70) {
msg ("and manage to land a solid hit. <br/>")
game.random1 = GetRandomInt(-1,2)
player.damage = 0 + player.atk - battle room.def
if (player.damage < 1) {
player.damage = 1
}
battle room.health = battle room.health - player.damage
}
else if (game.random >= 71) {
msg ("and land a powerful blow! That must've hurt!<br/>")
game.random1 = GetRandomInt(1,3)
player.damage = game.random1 + player.atk - battle room.def
if (player.damage < 2) {
player.damage = 2
}
battle room.health = battle room.health - player.damage
}
else {
}
]]></attack>
<invverbs>Equip</invverbs>
</object>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment