Refactored WeaponObject

The scripting of weapons should be much, much easier now. See the
included examples in DevService.

Attributes such as attack speed and range are now being read/written to
the actual items attributes.
This commit is contained in:
Ziggeh
2014-04-13 19:15:17 +02:00
parent b1f413e382
commit cbefc25121
7 changed files with 141 additions and 155 deletions
+6 -6
View File
@@ -18,7 +18,7 @@ def run(core, actor, target, commandString):
elementalType = weapon.getElementalType()
commandName = ''
if elementalType == '@obj_attr_n:elemental_heat':
if elementalType == 'heat':
if actor.getLevel() >= 58:
commandName = 'co_hw_dot_fire_1'
if actor.getLevel() >= 60:
@@ -29,7 +29,7 @@ def run(core, actor, target, commandString):
commandName = 'co_hw_dot_fire_4'
if actor.getLevel() >= 90:
commandName = 'co_hw_dot_fire_5'
elif elementalType == '@obj_attr_n:elemental_cold':
elif elementalType == 'cold':
if actor.getLevel() >= 58:
commandName = 'co_hw_dot_cold_1'
if actor.getLevel() >= 60:
@@ -40,7 +40,7 @@ def run(core, actor, target, commandString):
commandName = 'co_hw_dot_cold_4'
if actor.getLevel() >= 90:
commandName = 'co_hw_dot_cold_5'
elif elementalType == '@obj_attr_n:elemental_acid':
elif elementalType == 'acid':
if actor.getLevel() >= 58:
commandName = 'co_hw_dot_acid_1'
if actor.getLevel() >= 60:
@@ -51,7 +51,7 @@ def run(core, actor, target, commandString):
commandName = 'co_hw_dot_acid_4'
if actor.getLevel() >= 90:
commandName = 'co_hw_dot_acid_5'
elif elementalType == '@obj_attr_n:elemental_electricity':
elif elementalType == 'electricity':
if actor.getLevel() >= 58:
commandName = 'co_hw_dot_electrical_1'
if actor.getLevel() >= 60:
@@ -62,7 +62,7 @@ def run(core, actor, target, commandString):
commandName = 'co_hw_dot_electrical_4'
if actor.getLevel() >= 90:
commandName = 'co_hw_dot_electrical_5'
elif elementalType == '@obj_attr_n:elemental_energy':
elif elementalType == 'energy':
if actor.getLevel() >= 58:
commandName = 'co_hw_dot_energy_1'
if actor.getLevel() >= 60:
@@ -73,7 +73,7 @@ def run(core, actor, target, commandString):
commandName = 'co_hw_dot_energy_4'
if actor.getLevel() >= 90:
commandName = 'co_hw_dot_energy_5'
elif elementalType =='@obj_attr_n:elemental_kinetic':
elif elementalType =='kinetic':
if actor.getLevel() >= 58:
commandName = 'co_hw_dot_kinetic_1'
if actor.getLevel() >= 60:
+21 -9
View File
@@ -1,25 +1,37 @@
import sys
def Rifle():
def weap_0():
return "expertise_critical_rifle"
def Carbine():
def weap_1():
return "expertise_critical_carbine"
def Pistol():
def weap_2():
return "expertise_critical_pistol"
def OneHandedMelee():
def weap_4():
return "expertise_critical_1h"
def TwoHandedMelee():
def weap_5():
return "expertise_critical_2h"
def Unarmed():
def weap_6():
return "expertise_critical_unarmed"
def Polearm():
def weap_7():
return "expertise_critical_polearm"
def FreeTargetingHeavyWeapon():
def weap_9():
return ""
def weap_10():
return ""
def weap_11():
return ""
def weap_12():
return "expertise_critical_heavy"
def weap_13():
return "expertise_critical_heavy"
@@ -1,4 +1,11 @@
import sys
def setup(core, object):
object.setAttackSpeed(1)
object.setDamageType("kinetic")
object.setMinDamage(50)
object.setMaxDamage(100)
object.setMaxRange(5)
object.setWeaponType(6)
return