cyphesis/rulesets/basic/world/objects/tools/Bow.py
Al Riddoch ba4a73dfe5 2005-11-30 Al Riddoch <alriddoch@zepler.org>
* rulesets/basic/world/objects/Thing.py: Remove self.attributes
	  from the base class for all python scripts.

	* rulesets/mason/world/objects/Weather.py,
	  rulesets/basic/world/objects/plants/Tree.py,
	  rulesets/basic/world/objects/animals/Animal.py,
	  data/basic.xml, data/mason.xml: Don't use set_kw to handle default
	  attributes, and add the to the .xml rules files.

	* rulesets/basic/world/objects/buildings/House.py,
	  rulesets/basic/world/objects/buildings/StoneHouse.py,
	  rulesets/basic/world/objects/tools/Bow.py,
	  rulesets/basic/world/objects/tools/Sword.py,
	  rulesets/mason/world/objects/animals/Deer.py,
	  rulesets/mason/world/objects/animals/Pig.py,
	  rulesets/mason/world/objects/outdoor/Campfire.py,
	  rulesets/mason/world/objects/outdoor/Gravestone.py,
	  rulesets/mason/world/objects/plants/seeds/Acorn.py,
	  rulesets/mason/world/objects/plants/seeds/Apple.py,
	  rulesets/mason/world/objects/plants/seeds/Fircone.py,
	  rulesets/mason/world/objects/plants/seeds/Seed.py,
	  rulesets/mason/world/objects/tools/Cleaver.py,
	  rulesets/mason/world/objects/undead/Skeleton.py,
	  rulesets/werewolf/world/objects/characters/Villager.py,
	  rulesets/werewolf/world/objects/tools/Gallows.py:
	  Don't import set_kw from misc, as its now obsolete and unused.
2005-11-30 22:37:50 +00:00

28 lines
1.2 KiB
Python

#This file is distributed under the terms of the GNU General Public license.
#Copyright (C) 1999 Aloril (See the file COPYING for details).
#return Operation("create",Entity(name='wood',type=['lumber'],location=self.location.parent.location.copy()),to=self)
from atlas import *
from world.objects.Thing import Thing
from Vector3D import Vector3D
class Bow(Thing):
"""This is base class for bows, this one just ordinary bow"""
def shoot_operation(self, op):
ammo = op[0].id
to_ = op[1].id
target = self.world.get_object(to_)
vel = target.location.coordinates - self.location.parent.location.coordinates
time = vel.mag() / 5
vel = vel.unit_vector() * 5
loc1 = Location(self.location.parent.location.parent,self.location.parent.location.coordinates)
loc1.velocity = vel
loc2 = Location(target.location.parent,Point3D(0,0,0))
loc2.velocity = Vector3D(0,0,0)
m1 = Operation("move",Entity(ammo,location=loc1),to=ammo)
m2 = Operation("move",Entity(ammo,location=loc2),to=ammo)
m2.setFutureSeconds(time)
t = Operation("set",Entity(to_,status=-1),to=to_)
t.setFutureSeconds(time)
return Message(m1,m2,t)