From 4318122384f57f8e67cc31f6a65e27057798181c Mon Sep 17 00:00:00 2001 From: ryo_saeba Date: Sat, 12 Dec 2020 16:12:36 +0000 Subject: [PATCH] Add spell casting script for arrows, adapted from patch https://sourceforge.net/p/crossfire/patches/364/ git-svn-id: svn://svn.code.sf.net/p/crossfire/code/maps/trunk@21599 282e977c-c81d-0410-88c4-b93c2d0d6712 --- ChangeLog | 3 +++ python/items/spell_arrow.py | 19 +++++++++++++++++++ 2 files changed, 22 insertions(+) create mode 100644 python/items/spell_arrow.py diff --git a/ChangeLog b/ChangeLog index 2375e5be4..794d4fe5a 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,6 @@ +2020-12-12 Nicolas Weeger + * python/items/spell_arrow.py: Apply modified patch #364, see https://sourceforge.net/p/crossfire/patches/364/ + 2020-12-02 Nicolas Weeger * styles/cheststyles: Add map with available chests for random maps. This will allow removing hardcoded list in the server code. diff --git a/python/items/spell_arrow.py b/python/items/spell_arrow.py new file mode 100644 index 000000000..44a715c83 --- /dev/null +++ b/python/items/spell_arrow.py @@ -0,0 +1,19 @@ +import Crossfire + +who = Crossfire.WhoAmI() +victim = Crossfire.WhoIsOther(); + +spells = who.ReadKey("arrow_spell") +if spells and victim: + spells = spells.split(";") + for spell in spells: + if ":" in spell: + quantity, archetype = spell.split(":") + else: + quantity = 1 + archetype = spell + spellob = Crossfire.CreateObjectByName(archetype) + if spellob: + for r in range(0, int(quantity)): + victim.CastAbility(spellob, 0, "") + spellob.Remove()