forked from github/server
Nur Boote und Langboote koennen per Zauber fliegen.
Ein Item fuer den Flug von anderen Schiffen.
This commit is contained in:
parent
614aa80bdf
commit
c36b14e9e0
8 changed files with 89 additions and 21 deletions
|
@ -672,8 +672,13 @@ ship_allowed(const struct ship * sh, const region * r)
|
|||
static boolean
|
||||
flying_ship(const ship * sh)
|
||||
{
|
||||
static const curse_type * ct_flyingship;
|
||||
if (!ct_flyingship) {
|
||||
ct_flyingship = ct_find("flyingship");
|
||||
assert(ct_flyingship);
|
||||
}
|
||||
if (sh->type->flags & SFL_FLY) return true;
|
||||
if (is_cursed(sh->attribs, C_SHIP_FLYING, 0)) return true;
|
||||
if (curse_active(get_curse(sh->attribs, ct_flyingship))) return true;
|
||||
return false;
|
||||
}
|
||||
|
||||
|
|
|
@ -6544,10 +6544,22 @@ sp_movecastle(castorder *co)
|
|||
return cast_level;
|
||||
}
|
||||
|
||||
boolean
|
||||
shipcurse_flyingship(ship* sh, int power, int duration)
|
||||
curse *
|
||||
shipcurse_flyingship(ship* sh, unit * mage, double power, int duration)
|
||||
{
|
||||
return false;
|
||||
static const curse_type * ct_flyingship = NULL;
|
||||
if (!ct_flyingship) {
|
||||
ct_flyingship = ct_find("flyingship");
|
||||
assert(ct_flyingship);
|
||||
}
|
||||
if (curse_active(get_curse(sh->attribs, ct_flyingship))) {
|
||||
return NULL;
|
||||
} else if (is_cursed(sh->attribs, C_SHIP_SPEEDUP, 0)) {
|
||||
return NULL;
|
||||
} else {
|
||||
/* mit C_SHIP_NODRIFT haben wir kein Problem */
|
||||
return create_curse(mage, &sh->attribs, ct_flyingship, power, duration, zero_effect, 0);
|
||||
}
|
||||
}
|
||||
/* ------------------------------------------------------------- */
|
||||
/* Name: Luftschiff
|
||||
|
@ -6572,30 +6584,29 @@ sp_flying_ship(castorder *co)
|
|||
double power = co->force;
|
||||
spellparameter *pa = co->par;
|
||||
message * m = NULL;
|
||||
curse * c;
|
||||
|
||||
/* wenn kein Ziel gefunden, Zauber abbrechen */
|
||||
if (pa->param[0]->flag == TARGET_NOTFOUND) return 0;
|
||||
if (sh->type->construction->maxsize>50) {
|
||||
/* TODO: error message */
|
||||
return 0;
|
||||
}
|
||||
|
||||
sh = pa->param[0]->data.sh;
|
||||
|
||||
if (is_cursed(sh->attribs, C_SHIP_FLYING, 0) ) {
|
||||
/* sprintf(buf, "Auf dem Schiff befindet liegt bereits so ein Zauber."); */
|
||||
cmistake(mage, co->order, 211, MSG_MAGIC);
|
||||
return 0;
|
||||
}
|
||||
if (is_cursed(sh->attribs, C_SHIP_SPEEDUP, 0) ) {
|
||||
/* sprintf(buf, "Es ist zu gefährlich, ein sturmgepeitschtes Schiff "
|
||||
"fliegen zu lassen."); */
|
||||
cmistake(mage, co->order, 210, MSG_MAGIC);
|
||||
return 0;
|
||||
}
|
||||
/* mit C_SHIP_NODRIFT haben wir kein Problem */
|
||||
|
||||
/* Duration = 1, nur diese Runde */
|
||||
create_curse(mage, &sh->attribs, ct_find("flyingship"), power, 1, zero_effect, 0);
|
||||
/* Da der Spruch nur diese Runde wirkt, brauchen wir kein
|
||||
* set_cursedisplay() zu benutzten - es sieht eh niemand...
|
||||
*/
|
||||
c = shipcurse_flyingship(sh, mage, power, 1);
|
||||
if (c==NULL) {
|
||||
if (is_cursed(sh->attribs, C_SHIP_FLYING, 0) ) {
|
||||
/* Auf dem Schiff befindet liegt bereits so ein Zauber. */
|
||||
cmistake(mage, co->order, 211, MSG_MAGIC);
|
||||
} else if (is_cursed(sh->attribs, C_SHIP_SPEEDUP, 0) ) {
|
||||
/* Es ist zu gefährlich, ein sturmgepeitschtes Schiff fliegen zu lassen. */
|
||||
cmistake(mage, co->order, 210, MSG_MAGIC);
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
sh->coast = NODIRECTION;
|
||||
|
||||
/* melden, 1x pro Partei */
|
||||
|
|
|
@ -19,6 +19,8 @@ extern "C" {
|
|||
#endif
|
||||
|
||||
extern void register_spells(void);
|
||||
extern struct curse * shipcurse_flyingship(struct ship* sh, struct unit * mage, double power, int duration);
|
||||
|
||||
|
||||
/* für Feuerwände: in movement muß das noch explizit getestet werden.
|
||||
* besser wäre eine blcok_type::move() routine, die den effekt
|
||||
|
|
|
@ -13,11 +13,14 @@
|
|||
#include <gamecode/monster.h>
|
||||
#include <gamecode/creport.h>
|
||||
|
||||
#include <spells/spells.h>
|
||||
|
||||
// kernel includes
|
||||
#include <kernel/alliance.h>
|
||||
#include <kernel/equipment.h>
|
||||
#include <kernel/faction.h>
|
||||
#include <kernel/item.h>
|
||||
#include <kernel/ship.h>
|
||||
#include <kernel/message.h>
|
||||
#include <kernel/plane.h>
|
||||
#include <kernel/race.h>
|
||||
|
@ -265,6 +268,15 @@ process_orders(void)
|
|||
return 0;
|
||||
}
|
||||
|
||||
static int
|
||||
levitate_ship(ship& sh, unit& mage, double power, int duration)
|
||||
{
|
||||
curse * c = shipcurse_flyingship(&sh, &mage, power, duration);
|
||||
if (c) {
|
||||
return c->no;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
void
|
||||
bind_gamecode(lua_State * L)
|
||||
|
@ -290,6 +302,9 @@ bind_gamecode(lua_State * L)
|
|||
def("message_faction", &message_faction),
|
||||
def("message_region", &message_region),
|
||||
|
||||
/* spells and stuff */
|
||||
def("levitate_ship", &levitate_ship),
|
||||
|
||||
/* scripted monsters */
|
||||
def("spawn_braineaters", &spawn_braineaters),
|
||||
def("spawn_undead", &spawn_undead),
|
||||
|
|
|
@ -30,6 +30,9 @@
|
|||
</string>
|
||||
</namespace>
|
||||
<namespace name="iteminfo">
|
||||
<string name="ring_of_levitation">
|
||||
<text locale="de">Benutzt der Kapitän des Schiffes diesen Talisman, so wird allen an Bord befindlichen Mallornsamen ihre magisch Energie entzogen, und das Schiff kann mit dieser Energie bis zu zwei Wochen lang fliegen.</text>
|
||||
</string>
|
||||
<string name="birthdaycake">
|
||||
<text locale="de">Eine Geburtstagstorte mit 10 Kerzen. Herzlichen Glückwunsch, Eressea!</text>
|
||||
<text locale="en">A birthday cake with 10 candles. Happy Birthday, Eressea!</text>
|
||||
|
@ -166,6 +169,14 @@
|
|||
the sky one cold winter night, is said to have aphrodisiacal powers.</text>
|
||||
</string>
|
||||
</namespace>
|
||||
<string name="ring_of_levitation">
|
||||
<text locale="de">Ring der Levitation</text>
|
||||
<text locale="en">ring of levitation</text>
|
||||
</string>
|
||||
<string name="ring_of_levitation_p">
|
||||
<text locale="de">Ringe der Levitation</text>
|
||||
<text locale="en">rings of levitation</text>
|
||||
</string>
|
||||
<string name="birthdaycake">
|
||||
<text locale="de">Geburtstagstorte</text>
|
||||
<text locale="en">birthday cake</text>
|
||||
|
|
|
@ -22,6 +22,12 @@
|
|||
</item>
|
||||
</resource>
|
||||
|
||||
<resource name="ring_of_levitation" appearance="ring">
|
||||
<item notlost="yes" weight="0">
|
||||
<function name="use" value="lua_useitem"/>
|
||||
</item>
|
||||
</resource>
|
||||
|
||||
<resource name="birthdaycake">
|
||||
<item notlost="yes" weight="0"/>
|
||||
</resource>
|
||||
|
|
|
@ -30,6 +30,7 @@ function run_scripts()
|
|||
"eressea/eternath.lua",
|
||||
"eressea/wedding-jadee.lua",
|
||||
"eressea/ponnuki.lua",
|
||||
"eressea/items.lua",
|
||||
"eressea/xmas2004.lua",
|
||||
"eressea/10years.lua",
|
||||
"eressea/xmas2005.lua",
|
||||
|
|
17
src/scripts/eressea/items.lua
Normal file
17
src/scripts/eressea/items.lua
Normal file
|
@ -0,0 +1,17 @@
|
|||
function use_ring_of_levitation(u, amount)
|
||||
if u.ship~=nil and amount>0 then
|
||||
local mallorn = 0
|
||||
for u2 in u.region.units do
|
||||
local i = u2:get_item("mallornseed")
|
||||
if i>0 then
|
||||
u2:use_item("mallornseed", i)
|
||||
u2:add_item("seed", i)
|
||||
mallorn = mallorn + i
|
||||
end
|
||||
end
|
||||
if mallorn>0 then
|
||||
levitate_ship(u.ship, u, mallorn, 2)
|
||||
end
|
||||
end
|
||||
return 0
|
||||
end
|
Loading…
Reference in a new issue