forked from github/server
remove code for alp (non-functional)
remove code for removecurse trigger (only used by alp)
This commit is contained in:
parent
cae966f4fe
commit
75f2be75d8
|
@ -2906,23 +2906,6 @@
|
|||
<text locale="en">toad</text>
|
||||
</string>
|
||||
|
||||
<string name="alp">
|
||||
<text locale="de">Alp</text>
|
||||
<text locale="en">nightmare</text>
|
||||
</string>
|
||||
<string name="alp_p">
|
||||
<text locale="de">Alps</text>
|
||||
<text locale="en">nightmaress</text>
|
||||
</string>
|
||||
<string name="alp_d">
|
||||
<text locale="de">Alps</text>
|
||||
<text locale="en">nightmares</text>
|
||||
</string>
|
||||
<string name="alp_x">
|
||||
<text locale="de">Alp</text>
|
||||
<text locale="en">nightmare</text>
|
||||
</string>
|
||||
|
||||
<string name="mountainguard">
|
||||
<text locale="de">Bergwächter</text>
|
||||
<text locale="en">mountainguard</text>
|
||||
|
@ -4357,10 +4340,6 @@
|
|||
<text locale="de">Traumdeuten</text>
|
||||
<text locale="en">Mind Probe</text>
|
||||
</string>
|
||||
<string name="summon_alp">
|
||||
<text locale="de">Alp</text>
|
||||
<text locale="en">Nightmare</text>
|
||||
</string>
|
||||
<string name="create_dreameye">
|
||||
<text locale="de">Erschaffe ein Traumauge</text>
|
||||
<text locale="en">Create a Visioneye</text>
|
||||
|
@ -6424,25 +6403,6 @@
|
|||
target's faction, skills and possessions will no
|
||||
longer be unknown.</text>
|
||||
</string>
|
||||
<string name="summon_alp">
|
||||
<text locale="de">Der Magier beschwört ein kleines Monster, einen Alp. Dieses bewegt sich
|
||||
langsam auf sein Opfer zu (das sich an einem beliebigen Ort an der Welt
|
||||
befinden kann, der Magier oder seine Partei braucht es nicht zu sehen).
|
||||
Sobald das Opfer erreicht ist, wird es gnadenlos gequält, und nur durch
|
||||
einen starken Gegenzauber oder den Tod des beschwörenden Magiers kann
|
||||
das Opfer wieder Frieden finden. Bei der Beschwörung des Alps verliert
|
||||
der Magier einen kleinen Teil seiner Aura für immer.</text>
|
||||
<text locale="en">The magician spawns a little monster, a nightmare. The nightmare slowly
|
||||
approaches its victim (which may be at an arbitrary place in eressea, it
|
||||
is not needed for the magician or his party to see the victim). As soon
|
||||
as
|
||||
the victim is reached the nightmare starts to torment it without mercy,
|
||||
only a powerfull counter spell or the death of the casting magician can
|
||||
redeem
|
||||
the victim. When spawning the nightmare the magician loses a small amount
|
||||
of
|
||||
his aura forever.</text>
|
||||
</string>
|
||||
<string name="create_dreameye">
|
||||
<text locale="de">Ein mit diesem Zauber belegtes Drachenauge, welches zum Abendmahle
|
||||
verzehrt wird, erlaubt es dem Benutzer, in die Träume einer anderen
|
||||
|
@ -7354,11 +7314,6 @@
|
|||
<text locale="en">fire dragon</text>
|
||||
</string>
|
||||
|
||||
<string name="trigger_alp_destroy">
|
||||
<text locale="de">Ein Alp starb, ohne sein Ziel zu erreichen.</text>
|
||||
<text locale="en">An alp died before it reached its target.</text>
|
||||
</string>
|
||||
|
||||
<string name="unarmed">
|
||||
<text locale="de">unbewaffnet</text>
|
||||
<text locale="en">unarmed</text>
|
||||
|
|
|
@ -65,13 +65,6 @@
|
|||
<text locale="de">$unit($owner) bittet $unit($unit), $building($building) zu verlassen.</text>
|
||||
<text locale="en">$unit($owner) asks $unit($unit) to leave $building($building).</text>
|
||||
</message>
|
||||
<message name="alp_destroyed" section="events">
|
||||
<type>
|
||||
<arg name="region" type="region"/>
|
||||
</type>
|
||||
<text locale="de">Ein Alp starb in $region($region), ohne sein Ziel zu erreichen.</text>
|
||||
<text locale="en">An alp died in $region($region) before reaching its target.</text>
|
||||
</message>
|
||||
<message name="nr_claims" section="nr">
|
||||
<type>
|
||||
<arg name="items" type="items"/>
|
||||
|
@ -1277,11 +1270,6 @@
|
|||
<text locale="en">"$unit($unit) stumbles upon $localize($location) while exploring the region. Closer inspection reveals a torn old book titled '$localize($book)'. The expansion of knowledge is tremendous."</text>
|
||||
</message>
|
||||
|
||||
<message name="alp_success" section="events">
|
||||
<text locale="de">"Ein Alp hat sein Opfer gefunden und springt auf den Rücken von $unit($target)!"</text>
|
||||
<text locale="en">"An evil spirit has found its victim and mounts the back of $unit($target)!"</text>
|
||||
</message>
|
||||
|
||||
<message name="curseinfo::auraboost_0" section="events">
|
||||
<type>
|
||||
<arg name="unit" type="unit"/>
|
||||
|
@ -1469,16 +1457,6 @@
|
|||
<text locale="en">"$unit($mage) calls forth a terrible torment over the enemy. The magical rain makes all iron rusty."</text>
|
||||
</message>
|
||||
|
||||
<message name="summon_alp_effect" section="magic">
|
||||
<type>
|
||||
<arg name="mage" type="unit"/>
|
||||
<arg name="alp" type="unit"/>
|
||||
<arg name="target" type="unit"/>
|
||||
</type>
|
||||
<text locale="de">"$unit($mage) beschwört den Alp $unit($alp) für $unit($target)."</text>
|
||||
<text locale="en">"$unit($mage) summons the alp $unit($alp) for $unit($target)."</text>
|
||||
</message>
|
||||
|
||||
<message name="healing_effect_0" section="magic">
|
||||
<type>
|
||||
<arg name="mage" type="unit"/>
|
||||
|
|
|
@ -672,11 +672,6 @@
|
|||
<skill name="stamina" modifier="-10"/>
|
||||
<attack type="4" damage="1d2"/>
|
||||
</race>
|
||||
<race name="alp" magres="0.950000" maxaura="1.0" regaura="1.0" weight="0" capacity="0" speed="1.500000" hp="20" ac="2" damage="1d4" unarmedattack="0" unarmeddefense="0" attackmodifier="2" defensemodifier="20" fly="yes" walk="yes" canlearn="no" canteach="no">
|
||||
<ai splitsize="1"/>
|
||||
<function name="name" value="namegeneric"/>
|
||||
<attack type="1" damage="1d4"/>
|
||||
</race>
|
||||
<race name="mountainguard" unarmedguard="yes" magres="0.500000" maxaura="1.0" regaura="0.500000" weight="10000" capacity="2000" speed="0.000000" hp="1000" ac="12" damage="2d40" unarmedattack="0" unarmeddefense="0" attackmodifier="6" defensemodifier="8" cannotmove="yes" canlearn="no" teach="no" noweapons="yes">
|
||||
<ai splitsize="1"/>
|
||||
<function name="name" value="namegeneric"/>
|
||||
|
|
|
@ -671,11 +671,6 @@
|
|||
<skill name="stamina" modifier="-10"/>
|
||||
<attack type="4" damage="1d2"/>
|
||||
</race>
|
||||
<race name="alp" magres="0.950000" maxaura="1.000000" regaura="1.000000" recruitcost="50000" weight="0" capacity="0" speed="1.500000" hp="20" ac="2" damage="1d4" unarmedattack="0" unarmeddefense="0" attackmodifier="2" defensemodifier="20" fly="yes" walk="yes" canlearn="no" canteach="no">
|
||||
<ai splitsize="1"/>
|
||||
<function name="name" value="namegeneric"/>
|
||||
<attack type="1" damage="1d4"/>
|
||||
</race>
|
||||
<race name="mountainguard" unarmedguard="yes" magres="0.500000" maxaura="1.000000" regaura="0.500000" recruitcost="50000" weight="10000" capacity="2000" speed="0.000000" hp="1000" ac="12" damage="2d40" unarmedattack="0" unarmeddefense="0" attackmodifier="6" defensemodifier="8" cannotmove="yes" canlearn="no" teach="no" noweapons="yes">
|
||||
<ai splitsize="1"/>
|
||||
<function name="name" value="namegeneric"/>
|
||||
|
|
|
@ -142,7 +142,6 @@
|
|||
<entry spell="stonegolem" level="1" />
|
||||
<entry spell="stormwinds" level="6" />
|
||||
<entry spell="strongwall" level="8" />
|
||||
<!-- <entry spell="summon_alp" level="15" /> -->
|
||||
<entry spell="summondragon" level="11" />
|
||||
<entry spell="summonent" level="10" />
|
||||
<entry spell="summon_familiar" level="9" />
|
||||
|
|
|
@ -8,7 +8,6 @@
|
|||
<entry spell="transferauratraum" level="3" />
|
||||
<entry spell="disturbingdreams" level="6" />
|
||||
<entry spell="sleep" level="7" />
|
||||
<!-- <entry spell="summon_alp" level="15" /> -->
|
||||
<entry spell="mindblast" level="11" />
|
||||
<entry spell="reanimate" level="5" />
|
||||
<entry spell="shapeshift" level="3" />
|
||||
|
|
|
@ -188,13 +188,6 @@
|
|||
<resource name="h12" amount="1" cost="fixed"/>
|
||||
<resource name="h20" amount="1" cost="fixed"/>
|
||||
</spell>
|
||||
<!--
|
||||
<spell name="summon_alp" rank="5" index="58" parameters="u" target_global="true">
|
||||
<resource name="aura" amount="350" cost="fixed"/>
|
||||
<resource name="permaura" amount="5" cost="fixed"/>
|
||||
<resource name="h8" amount="1" cost="fixed"/>
|
||||
</spell>
|
||||
-->
|
||||
<spell name="windshield" rank="5" index="59" variable="true" combat="1">
|
||||
<resource name="aura" amount="2" cost="level"/>
|
||||
</spell>
|
||||
|
|
|
@ -71,25 +71,6 @@ function test_rename()
|
|||
assert_equal(u:get_item("ao_healing"), 1)
|
||||
end
|
||||
|
||||
function DISABLE_test_alp()
|
||||
local r = region.create(0,0, "plain")
|
||||
local f = faction.create("noreply@eressea.de", "human", "de")
|
||||
local u = unit.create(f, r, 1)
|
||||
local u2 = unit.create(f, r, 1)
|
||||
u.race = "elf"
|
||||
u:set_skill("magic", 10)
|
||||
u:add_item("money", 3010)
|
||||
u.magic = "illaun"
|
||||
u.aura = 200
|
||||
u.ship = s1
|
||||
u:add_spell("summon_alp")
|
||||
u:clear_orders()
|
||||
u:add_order("ZAUBERE 'Alp' " .. itoa36(u2.id))
|
||||
process_orders()
|
||||
print(get_turn(), f)
|
||||
write_reports()
|
||||
end
|
||||
|
||||
function test_unit_limit_is_1500()
|
||||
local r = region.create(0,0, "plain")
|
||||
local f = faction.create("noreply@eressea.de", "human", "de")
|
||||
|
|
|
@ -25,9 +25,6 @@ OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
|||
#include "give.h"
|
||||
#include "move.h"
|
||||
|
||||
/* triggers includes */
|
||||
#include <triggers/removecurse.h>
|
||||
|
||||
/* attributes includes */
|
||||
#include <attributes/targetregion.h>
|
||||
#include <attributes/hate.h>
|
||||
|
|
|
@ -28,9 +28,6 @@
|
|||
#include "keyword.h"
|
||||
#include "study.h"
|
||||
|
||||
/* triggers includes */
|
||||
#include <triggers/removecurse.h>
|
||||
|
||||
/* attributes includes */
|
||||
#include <attributes/targetregion.h>
|
||||
#include <attributes/hate.h>
|
||||
|
|
|
@ -30,7 +30,6 @@
|
|||
#include <spells/unitcurse.h>
|
||||
#include <spells/shipcurse.h>
|
||||
#include <spells/combatspells.h>
|
||||
#include <spells/alp.h>
|
||||
#include <spells/flyingship.h>
|
||||
|
||||
/* kernel includes */
|
||||
|
@ -6510,7 +6509,6 @@ static spelldata spell_functions[] = {
|
|||
{ "bad_dreams", sp_baddreams, 0 },
|
||||
{ "mindblast", sp_mindblast_temp, 0 },
|
||||
{ "orkdream", sp_sweetdreams, 0 },
|
||||
{ "summon_alp", sp_summon_alp, 0 }, // TODO: this spell is disabled everywhere
|
||||
/* M_CERDDOR */
|
||||
{ "appeasement", sp_denyattack, 0 },
|
||||
{ "song_of_healing", sp_healing, 0 },
|
||||
|
@ -6707,9 +6705,6 @@ void register_spells(void)
|
|||
at_register(&at_wdwpyramid);
|
||||
at_register(&at_deathcloud_compat);
|
||||
|
||||
/* sp_summon_alp */
|
||||
register_alp();
|
||||
|
||||
/* init_firewall(); */
|
||||
ct_register(&ct_firewall);
|
||||
ct_register(&ct_deathcloud);
|
||||
|
|
|
@ -1,6 +1,5 @@
|
|||
PROJECT(spells C)
|
||||
SET(_FILES
|
||||
alp.c
|
||||
borders.c
|
||||
buildingcurse.c
|
||||
combatspells.c
|
||||
|
|
204
src/spells/alp.c
204
src/spells/alp.c
|
@ -1,204 +0,0 @@
|
|||
/*
|
||||
*
|
||||
* Eressea PB(E)M host Copyright (C) 1998-2015
|
||||
* Christian Schlittchen (corwin@amber.kn-bremen.de)
|
||||
* Katja Zedel (katze@felidae.kn-bremen.de)
|
||||
* Henning Peters (faroul@beyond.kn-bremen.de)
|
||||
* Enno Rehling (enno@eressea.de)
|
||||
* Ingo Wilken (Ingo.Wilken@informatik.uni-oldenburg.de)
|
||||
*
|
||||
* This program may not be used, modified or distributed without
|
||||
* prior permission by the authors of Eressea.
|
||||
*/
|
||||
|
||||
#include <platform.h>
|
||||
#include <kernel/config.h>
|
||||
#include "alp.h"
|
||||
|
||||
#include <kernel/curse.h>
|
||||
#include <kernel/faction.h>
|
||||
#include <kernel/messages.h>
|
||||
#include <kernel/race.h>
|
||||
#include <kernel/region.h>
|
||||
#include <kernel/unit.h>
|
||||
|
||||
/* util includes */
|
||||
#include <util/attrib.h>
|
||||
#include <util/event.h>
|
||||
#include <util/gamedata.h>
|
||||
#include <util/resolve.h>
|
||||
#include <util/umlaut.h>
|
||||
|
||||
#include "monster.h"
|
||||
|
||||
#include <storage.h>
|
||||
|
||||
#include <triggers/createcurse.h>
|
||||
#include <triggers/killunit.h>
|
||||
#include <triggers/removecurse.h>
|
||||
#include <triggers/unitmessage.h>
|
||||
|
||||
/* libc includes */
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <assert.h>
|
||||
|
||||
extern const char *directions[];
|
||||
|
||||
typedef struct alp_data {
|
||||
unit *mage;
|
||||
unit *target; // TODO: remove, use attribute-owner?
|
||||
} alp_data;
|
||||
|
||||
static void alp_init(attrib * a)
|
||||
{
|
||||
a->data.v = calloc(sizeof(alp_data), 1);
|
||||
}
|
||||
|
||||
static void alp_done(attrib * a)
|
||||
{
|
||||
free(a->data.v);
|
||||
}
|
||||
|
||||
static int alp_verify(attrib * a, void *owner)
|
||||
{
|
||||
alp_data *ad = (alp_data *)a->data.v;
|
||||
unused_arg(owner);
|
||||
if (ad->mage && ad->target)
|
||||
return 1;
|
||||
return 0; /* remove the attribute */
|
||||
}
|
||||
|
||||
static void
|
||||
alp_write(const attrib * a, const void *owner, struct storage *store)
|
||||
{
|
||||
alp_data *ad = (alp_data *)a->data.v;
|
||||
write_unit_reference(ad->mage, store);
|
||||
write_unit_reference(ad->target, store);
|
||||
}
|
||||
|
||||
static int alp_read(attrib * a, void *owner, struct gamedata *data)
|
||||
{
|
||||
alp_data *ad = (alp_data *)a->data.v;
|
||||
int rm = read_reference(&ad->mage, data, read_unit_reference, resolve_unit);
|
||||
int rt =
|
||||
read_reference(&ad->target, data, read_unit_reference, resolve_unit);
|
||||
if (rt == 0 && rm == 0 && (!ad->target || !ad->mage)) {
|
||||
/* the target or mage disappeared. */
|
||||
return AT_READ_FAIL;
|
||||
}
|
||||
return AT_READ_OK;
|
||||
}
|
||||
|
||||
static attrib_type at_alp = {
|
||||
"alp",
|
||||
alp_init,
|
||||
alp_done,
|
||||
alp_verify,
|
||||
alp_write,
|
||||
alp_read,
|
||||
NULL,
|
||||
ATF_UNIQUE
|
||||
};
|
||||
|
||||
int sp_summon_alp(struct castorder *co)
|
||||
{
|
||||
unit *alp, *opfer;
|
||||
region *r = co_get_region(co);
|
||||
unit *mage = co->magician.u;
|
||||
int cast_level = co->level;
|
||||
spellparameter *pa = co->par;
|
||||
const struct race *rc = get_race(RC_ALP);
|
||||
struct faction *f = get_monsters();
|
||||
struct message *msg;
|
||||
|
||||
opfer = pa->param[0]->data.u;
|
||||
|
||||
/* Der Alp gehört den Monstern, darum erhält der Magier auch keine
|
||||
* Regionsberichte von ihm. Er erhält aber später eine Mitteilung,
|
||||
* sobald der Alp sein Opfer erreicht hat.
|
||||
*/
|
||||
alp = create_unit(r, f, 1, rc, 0, NULL, NULL);
|
||||
set_level(alp, SK_STEALTH, 7);
|
||||
setstatus(alp, ST_FLEE); /* flieht */
|
||||
|
||||
{
|
||||
attrib *a = a_add(&alp->attribs, a_new(&at_alp));
|
||||
alp_data *ad = (alp_data *)a->data.v;
|
||||
ad->mage = mage;
|
||||
ad->target = opfer;
|
||||
}
|
||||
|
||||
{
|
||||
/* Wenn der Alp stirbt, den Magier nachrichtigen */
|
||||
add_trigger(&alp->attribs, "destroy", trigger_unitmessage(mage,
|
||||
"trigger_alp_destroy", MSG_EVENT, ML_INFO));
|
||||
/* Wenn Opfer oder Magier nicht mehr existieren, dann stirbt der Alp */
|
||||
add_trigger(&mage->attribs, "destroy", trigger_killunit(alp));
|
||||
add_trigger(&opfer->attribs, "destroy", trigger_killunit(alp));
|
||||
}
|
||||
msg = msg_message("summon_alp_effect", "mage alp target", mage, alp, opfer);
|
||||
r_addmessage(r, mage->faction, msg);
|
||||
msg_release(msg);
|
||||
|
||||
return cast_level;
|
||||
}
|
||||
|
||||
void alp_findet_opfer(unit * alp, region * r)
|
||||
{
|
||||
curse *c;
|
||||
attrib *a = a_find(alp->attribs, &at_alp);
|
||||
alp_data *ad = (alp_data *)a->data.v;
|
||||
unit *mage = ad->mage;
|
||||
unit *opfer = ad->target;
|
||||
float effect;
|
||||
message *msg;
|
||||
|
||||
assert(opfer);
|
||||
assert(mage);
|
||||
|
||||
/* Magier und Opfer Bescheid geben */
|
||||
msg = msg_message("alp_success", "target", opfer);
|
||||
add_message(&mage->faction->msgs, msg);
|
||||
r_addmessage(opfer->region, opfer->faction, msg);
|
||||
msg_release(msg);
|
||||
|
||||
/* Relations werden in destroy_unit(alp) automatisch gelöscht.
|
||||
* Die Aktionen, die beim Tod des Alps ausgelöst werden sollen,
|
||||
* müssen jetzt aber deaktiviert werden, sonst werden sie gleich
|
||||
* beim destroy_unit(alp) ausgelöst.
|
||||
*/
|
||||
a_removeall(&alp->attribs, &at_eventhandler);
|
||||
|
||||
/* Alp umwandeln in Curse */
|
||||
effect = -2;
|
||||
c =
|
||||
create_curse(mage, &opfer->attribs, ct_find("worse"), 2, 2, effect,
|
||||
opfer->number);
|
||||
/* solange es noch keine spezielle alp-Antimagie gibt, reagiert der
|
||||
* auch auf normale */
|
||||
set_number(alp, 0);
|
||||
|
||||
/* wenn der Magier stirbt, wird der Curse wieder vom Opfer genommen */
|
||||
add_trigger(&mage->attribs, "destroy", trigger_removecurse(c, opfer));
|
||||
}
|
||||
|
||||
void register_alp(void)
|
||||
{
|
||||
at_register(&at_alp);
|
||||
}
|
||||
|
||||
unit *alp_target(unit * alp)
|
||||
{
|
||||
alp_data *ad;
|
||||
unit *target = NULL;
|
||||
|
||||
attrib *a = a_find(alp->attribs, &at_alp);
|
||||
|
||||
if (a) {
|
||||
ad = (alp_data *)a->data.v;
|
||||
target = ad->target;
|
||||
}
|
||||
return target;
|
||||
|
||||
}
|
|
@ -1,53 +0,0 @@
|
|||
/*
|
||||
*
|
||||
*
|
||||
* Eressea PB(E)M host Copyright (C) 1998-2003
|
||||
* Christian Schlittchen (corwin@amber.kn-bremen.de)
|
||||
* Katja Zedel (katze@felidae.kn-bremen.de)
|
||||
* Henning Peters (faroul@beyond.kn-bremen.de)
|
||||
* Enno Rehling (enno@eressea.de)
|
||||
* Ingo Wilken (Ingo.Wilken@informatik.uni-oldenburg.de)
|
||||
*
|
||||
* This program may not be used, modified or distributed without
|
||||
* prior permission by the authors of Eressea.
|
||||
*/
|
||||
|
||||
#ifndef ALP_H
|
||||
#define ALP_H
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
struct castorder;
|
||||
struct region;
|
||||
struct unit;
|
||||
/* ------------------------------------------------------------- */
|
||||
/* Name: Alp
|
||||
* Stufe: 15
|
||||
* Gebiet: Illaun
|
||||
* Wirkung:
|
||||
* Erschafft ein kleines Monster (den Alp). Dieser bewegt sich jede
|
||||
* zweite Runde auf eine Zieleinheit zu. Sobald das Ziel erreicht ist,
|
||||
* verwandelt es sich in einen Curse auf die Einheit, welches -2 auf
|
||||
* alle Talente bewirkt.
|
||||
*
|
||||
* Fähigkeiten (factypes.c):
|
||||
* Der Alp hat mittlere Tarnung (T7) und exzellente Verteidigung
|
||||
* (+20, 99% Magieresistenz, siehe factypes.c)
|
||||
*
|
||||
* TODO: Der Alp-Curse sollte sich durch besondere Antimagie (Tybied)
|
||||
* entfernen lassen.
|
||||
*
|
||||
* (UNITSPELL | SEARCHGLOBAL | TESTRESISTANCE)
|
||||
*/
|
||||
|
||||
extern int sp_summon_alp(struct castorder *co);
|
||||
extern void register_alp(void);
|
||||
|
||||
struct unit *alp_target(struct unit *alp);
|
||||
void alp_findet_opfer(struct unit *alp, struct region *r);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
#endif
|
|
@ -8,7 +8,6 @@ createunit.c
|
|||
gate.c
|
||||
giveitem.c
|
||||
killunit.c
|
||||
removecurse.c
|
||||
shock.c
|
||||
timeout.c
|
||||
triggers.c
|
||||
|
|
|
@ -1,111 +0,0 @@
|
|||
/*
|
||||
Copyright (c) 1998-2015, Enno Rehling <enno@eressea.de>
|
||||
Katja Zedel <katze@felidae.kn-bremen.de
|
||||
Christian Schlittchen <corwin@amber.kn-bremen.de>
|
||||
|
||||
Permission to use, copy, modify, and/or distribute this software for any
|
||||
purpose with or without fee is hereby granted, provided that the above
|
||||
copyright notice and this permission notice appear in all copies.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
|
||||
WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
|
||||
MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
|
||||
ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
|
||||
WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
|
||||
ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
|
||||
OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
||||
**/
|
||||
|
||||
#include <platform.h>
|
||||
#include <kernel/config.h>
|
||||
#include "removecurse.h"
|
||||
|
||||
/* kernel includes */
|
||||
#include <kernel/curse.h>
|
||||
#include <kernel/unit.h>
|
||||
|
||||
/* util includes */
|
||||
#include <util/attrib.h>
|
||||
#include <util/base36.h>
|
||||
#include <util/event.h>
|
||||
#include <util/gamedata.h>
|
||||
#include <util/log.h>
|
||||
#include <util/resolve.h>
|
||||
|
||||
#include <storage.h>
|
||||
|
||||
/* ansi includes */
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <assert.h>
|
||||
|
||||
#include <stdio.h>
|
||||
|
||||
typedef struct removecurse_data {
|
||||
curse *curse;
|
||||
unit *target;
|
||||
} removecurse_data;
|
||||
|
||||
static void removecurse_init(trigger * t)
|
||||
{
|
||||
t->data.v = calloc(sizeof(removecurse_data), 1);
|
||||
}
|
||||
|
||||
static void removecurse_free(trigger * t)
|
||||
{
|
||||
free(t->data.v);
|
||||
}
|
||||
|
||||
static int removecurse_handle(trigger * t, void *data)
|
||||
{
|
||||
/* call an event handler on removecurse.
|
||||
* data.v -> ( variant event, int timer )
|
||||
*/
|
||||
removecurse_data *td = (removecurse_data *)t->data.v;
|
||||
if (td->curse && td->target) {
|
||||
if (!remove_curse(&td->target->attribs, td->curse)) {
|
||||
log_error("could not perform removecurse::handle()\n");
|
||||
}
|
||||
}
|
||||
unused_arg(data);
|
||||
return 0;
|
||||
}
|
||||
|
||||
static void removecurse_write(const trigger * t, struct storage *store)
|
||||
{
|
||||
removecurse_data *td = (removecurse_data *)t->data.v;
|
||||
WRITE_TOK(store, td->target ? itoa36(td->target->no) : 0);
|
||||
WRITE_INT(store, td->curse ? td->curse->no : 0);
|
||||
}
|
||||
|
||||
static variant read_curse_reference(struct gamedata *data) {
|
||||
return read_int(data->store);
|
||||
}
|
||||
|
||||
static int removecurse_read(trigger * t, gamedata *data)
|
||||
{
|
||||
removecurse_data *td = (removecurse_data *)t->data.v;
|
||||
|
||||
read_reference(&td->target, data, read_unit_reference, resolve_unit);
|
||||
read_reference(&td->curse, data, read_curse_reference, resolve_curse);
|
||||
|
||||
return AT_READ_OK;
|
||||
}
|
||||
|
||||
trigger_type tt_removecurse = {
|
||||
"removecurse",
|
||||
removecurse_init,
|
||||
removecurse_free,
|
||||
removecurse_handle,
|
||||
removecurse_write,
|
||||
removecurse_read
|
||||
};
|
||||
|
||||
trigger *trigger_removecurse(curse * c, unit * target)
|
||||
{
|
||||
trigger *t = t_new(&tt_removecurse);
|
||||
removecurse_data *td = (removecurse_data *)t->data.v;
|
||||
td->curse = c;
|
||||
td->target = target;
|
||||
return t;
|
||||
}
|
|
@ -1,40 +0,0 @@
|
|||
/*
|
||||
Copyright (c) 1998-2015, Enno Rehling <enno@eressea.de>
|
||||
Katja Zedel <katze@felidae.kn-bremen.de
|
||||
Christian Schlittchen <corwin@amber.kn-bremen.de>
|
||||
|
||||
Permission to use, copy, modify, and/or distribute this software for any
|
||||
purpose with or without fee is hereby granted, provided that the above
|
||||
copyright notice and this permission notice appear in all copies.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
|
||||
WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
|
||||
MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
|
||||
ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
|
||||
WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
|
||||
ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
|
||||
OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
||||
**/
|
||||
|
||||
#ifndef REMOVECURSE_H
|
||||
#define REMOVECURSE_H
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/* all types we use are defined here to reduce dependencies */
|
||||
struct trigger_type;
|
||||
struct trigger;
|
||||
|
||||
struct unit;
|
||||
struct curse;
|
||||
|
||||
extern struct trigger_type tt_removecurse;
|
||||
|
||||
extern struct trigger *trigger_removecurse(struct curse *c,
|
||||
struct unit *target);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
#endif
|
|
@ -28,7 +28,6 @@ OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
|||
#include <triggers/unguard.h>
|
||||
#include <triggers/giveitem.h>
|
||||
#include <triggers/killunit.h>
|
||||
#include <triggers/removecurse.h>
|
||||
#include <triggers/shock.h>
|
||||
#include <triggers/timeout.h>
|
||||
#include <triggers/unitmessage.h>
|
||||
|
@ -50,7 +49,6 @@ void register_triggers(void)
|
|||
tt_register(&tt_unguard);
|
||||
tt_register(&tt_giveitem);
|
||||
tt_register(&tt_killunit);
|
||||
tt_register(&tt_removecurse);
|
||||
tt_register(&tt_shock);
|
||||
tt_register(&tt_unitmessage);
|
||||
tt_register(&tt_timeout);
|
||||
|
|
Loading…
Reference in New Issue