forked from github/server
Zauber Nebel der Verwirrung hat keine Funktion - verwirrung für schiffe implementiert. - neue waffe: schneeball. nur für schneemänner, hoffe ich
This commit is contained in:
parent
c7fe0c33ca
commit
90e8fb11fd
|
@ -718,7 +718,7 @@ enum {
|
||||||
D_WEST,
|
D_WEST,
|
||||||
MAXDIRECTIONS,
|
MAXDIRECTIONS,
|
||||||
D_PAUSE,
|
D_PAUSE,
|
||||||
D_SPECIAL,
|
D_SPECIAL,
|
||||||
NODIRECTION = (direction_t) - 1
|
NODIRECTION = (direction_t) - 1
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -1037,10 +1037,87 @@ cap_route(region * r, region_list * route, region_list * route_end, int speed)
|
||||||
return iroute;
|
return iroute;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static boolean
|
||||||
|
is_disoriented(unit *u)
|
||||||
|
{
|
||||||
|
static boolean init = false;
|
||||||
|
static const curse_type * shipconf_ct, * regconf_ct;
|
||||||
|
if (!init) {
|
||||||
|
init = true;
|
||||||
|
regconf_ct = ct_find("disorientationzone");
|
||||||
|
shipconf_ct = ct_find("shipdisorientation");
|
||||||
|
}
|
||||||
|
if (u->ship && curse_active(get_curse(u->ship->attribs, shipconf_ct)))
|
||||||
|
return true;
|
||||||
|
|
||||||
|
if (curse_active(get_curse(u->region->attribs, regconf_ct)))
|
||||||
|
return true;
|
||||||
|
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
/** ships regain their orientation
|
||||||
|
* Das Schiff bekommt seine Orientierung zurück, wenn es:
|
||||||
|
* a) An Land treibt,
|
||||||
|
* b) Glück hat, oder
|
||||||
|
* c) in einer Region mit einem nicht verwirrten alliierten
|
||||||
|
* Schiff steht.
|
||||||
|
*/
|
||||||
|
static void
|
||||||
|
regain_orientation(region * r)
|
||||||
|
{
|
||||||
|
ship *sh;
|
||||||
|
static int thismonth = -1;
|
||||||
|
static const curse_type * shipconf_ct, * regconf_ct;
|
||||||
|
static boolean init = false;
|
||||||
|
|
||||||
|
if (!init) {
|
||||||
|
init = true;
|
||||||
|
regconf_ct = ct_find("disorientationzone");
|
||||||
|
shipconf_ct = ct_find("shipdisorientation");
|
||||||
|
}
|
||||||
|
|
||||||
|
if (thismonth<0) thismonth = get_gamedate(turn, 0)->month;
|
||||||
|
|
||||||
|
for (sh = r->ships; sh; sh = sh->next) {
|
||||||
|
unit * u, *cap;
|
||||||
|
curse * c = get_curse(sh->attribs, shipconf_ct);
|
||||||
|
if (c==NULL) continue;
|
||||||
|
|
||||||
|
cap = shipowner(sh);
|
||||||
|
if (cap==NULL) continue;
|
||||||
|
|
||||||
|
if (!fval(r->terrain, SEA_REGION) || rand() % 10 >= storms[thismonth]) {
|
||||||
|
remove_curse(&sh->attribs, c);
|
||||||
|
ADDMSG(&cap->faction->msgs, msg_message("shipnoconf", "ship", sh));
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
for (u=r->units; u; u=u->next) {
|
||||||
|
/* we get help if u helps the faction of cap and isn't disoriented */
|
||||||
|
if (u != cap && alliedunit(u, cap->faction, HELP_GUARD) && !is_disoriented(u)) {
|
||||||
|
remove_curse(&sh->attribs, c);
|
||||||
|
ADDMSG(&cap->faction->msgs, msg_message("shipnoconf", "ship", sh));
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
static region *
|
static region *
|
||||||
next_region(unit * u, region * current, region * next)
|
next_region(unit * u, region * current, region * next)
|
||||||
{
|
{
|
||||||
border * b = get_borders(current, next);
|
border * b;
|
||||||
|
|
||||||
|
if (is_disoriented(u)) {
|
||||||
|
direction_t d = reldirection(current, next);
|
||||||
|
if (d<MAXDIRECTIONS) {
|
||||||
|
d = (direction_t)(((d+MAXDIRECTIONS-1)+rand()%3)%MAXDIRECTIONS);
|
||||||
|
next = rconnect(current, d);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
b = get_borders(current, next);
|
||||||
while (b!=NULL) {
|
while (b!=NULL) {
|
||||||
if (b->type->move) {
|
if (b->type->move) {
|
||||||
region * rto = b->type->move(b, u, current, next, true);
|
region * rto = b->type->move(b, u, current, next, true);
|
||||||
|
@ -1064,7 +1141,7 @@ reroute(unit * u, region_list * route, region_list * route_end)
|
||||||
while (route!=route_end) {
|
while (route!=route_end) {
|
||||||
region * next = next_region(u, current, route->data);
|
region * next = next_region(u, current, route->data);
|
||||||
if (next!=route->data) break;
|
if (next!=route->data) break;
|
||||||
route=route->next;
|
route = route->next;
|
||||||
}
|
}
|
||||||
return route;
|
return route;
|
||||||
}
|
}
|
||||||
|
@ -2203,67 +2280,6 @@ destroy_damaged_ships(void)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef TODO /* Wenn Feature ausgearbeitet */
|
|
||||||
|
|
||||||
static boolean
|
|
||||||
is_disorientated(unit *u)
|
|
||||||
{
|
|
||||||
static boolean init = false;
|
|
||||||
static const curse_type * shipconf_ct, * regconf_ct;
|
|
||||||
if (!init) {
|
|
||||||
init = true;
|
|
||||||
regconf_ct = ct_find("disorientationzone");
|
|
||||||
shipconf_ct = ct_find("shipdisorientation");
|
|
||||||
}
|
|
||||||
if (u->ship && curse_active(get_curse(u->ship->attribs, shipconf_ct)))
|
|
||||||
return true;
|
|
||||||
|
|
||||||
if (curse_active(get_curse(u->region->attribs, regconf_ct)))
|
|
||||||
return true;
|
|
||||||
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
void
|
|
||||||
regain_orientation(region * r)
|
|
||||||
{
|
|
||||||
ship *sh;
|
|
||||||
curse *c;
|
|
||||||
unit *u, *cap;
|
|
||||||
static int thismonth = get_gamedate(turn, 0)->month;
|
|
||||||
|
|
||||||
for (sh = r->ships; sh; sh = sh->next) {
|
|
||||||
c = get_curse(sh->attribs, C_DISORIENTATION, 0);
|
|
||||||
if(!c) continue;
|
|
||||||
|
|
||||||
/* Das Schiff bekommt seine Orientierung zurück, wenn es:
|
|
||||||
* a) An Land treibt.
|
|
||||||
* b) Glück hat.
|
|
||||||
* c) In einer Region mit einem nicht verwirrten alliierten
|
|
||||||
* Schiff steht.
|
|
||||||
*/
|
|
||||||
|
|
||||||
cap = shipowner(r, sh);
|
|
||||||
|
|
||||||
if (r->terrain != T_OCEAN || rand() % 10 >= storms[thismonth]) {
|
|
||||||
remove_curse(&sh->attribs, C_DISORIENTATION, 0);
|
|
||||||
ADDMSG(&cap->faction->msgs, msg_message("shipnoconf", "ship", sh));
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
|
|
||||||
for(u=r->units;u;u=u->next) {
|
|
||||||
if(u != cap
|
|
||||||
&& allied(cap, u->faction, HELP_GUARD)
|
|
||||||
&& is_disorientated(u) == false) {
|
|
||||||
remove_curse(&sh->attribs, C_DISORIENTATION, 0);
|
|
||||||
ADDMSG(&cap->faction->msgs, msg_message("shipnoconf", "ship", sh));
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
/* Bewegung, Verfolgung, Piraterie */
|
/* Bewegung, Verfolgung, Piraterie */
|
||||||
|
|
||||||
/** ships that folow other ships
|
/** ships that folow other ships
|
||||||
|
@ -2375,6 +2391,11 @@ movement(void)
|
||||||
unit ** up = &r->units;
|
unit ** up = &r->units;
|
||||||
boolean repeat = false;
|
boolean repeat = false;
|
||||||
|
|
||||||
|
if (ships==0) {
|
||||||
|
/* first thing before moving: restore orientation if we can */
|
||||||
|
regain_orientation(r);
|
||||||
|
}
|
||||||
|
|
||||||
while (*up) {
|
while (*up) {
|
||||||
unit *u = *up;
|
unit *u = *up;
|
||||||
keyword_t kword = get_keyword(u->thisorder);
|
keyword_t kword = get_keyword(u->thisorder);
|
||||||
|
|
|
@ -1,10 +1,18 @@
|
||||||
<?xml version="1.0"?>
|
<?xml version="1.0" encoding="iso-8859-1" ?>
|
||||||
<resources>
|
<resources>
|
||||||
|
|
||||||
<!-- xmas gimmicks -->
|
<!-- xmas gimmicks -->
|
||||||
<resource name="snowball">
|
<resource name="snowball">
|
||||||
<item notlost="yes" weight="0">
|
<item notlost="yes" weight="0">
|
||||||
<function name="use" value="lua_useitem"/>
|
<weapon bash="true" missile="true" skill="unarmed" offmod="0" defmod="0" reload="0" magres="0.0">
|
||||||
|
<damage type="rider" value="3d6+4"/>
|
||||||
|
<damage type="footman" value="3d6+4"/>
|
||||||
|
<modifier type="missile_target" value="2"/>
|
||||||
|
<modifier type="skill" value="-90"/>
|
||||||
|
<modifier type="skill" value="100">
|
||||||
|
<race name="snowman"/>
|
||||||
|
</modifier>
|
||||||
|
</weapon>
|
||||||
</item>
|
</item>
|
||||||
</resource>
|
</resource>
|
||||||
|
|
||||||
|
|
|
@ -1,9 +1,10 @@
|
||||||
|
<?xml version="1.0" encoding="iso-8859-1" ?>
|
||||||
<races>
|
<races>
|
||||||
<race name="snowman" magres="0.800000" maxaura="0.000000"
|
<race name="snowman" magres="0.800000" maxaura="0.000000"
|
||||||
regaura="0.000000" weight="500" capacity="200" equipment="no"
|
regaura="0.000000" weight="500" capacity="200" equipment="no"
|
||||||
speed="1.000000" hp="20" ac="4" damage="2d4" unarmedattack="10"
|
speed="1.000000" hp="1000" ac="4" damage="2d4" unarmedattack="10"
|
||||||
unarmeddefense="10" attackmodifier="8" defensemodifier="8"
|
unarmeddefense="10" attackmodifier="8" defensemodifier="8"
|
||||||
fly="no" walk="no" teach="no" getitem="no">
|
fly="no" walk="no" teach="no" getitem="yes">
|
||||||
<attack type="4" damage="2d6+2"/>
|
<attack type="4" damage="2d6+2"/>
|
||||||
<attack type="3" damage="2d6+2"/>
|
<attack type="3" damage="2d6+2"/>
|
||||||
</race>
|
</race>
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
<?xml version="1.0"?>
|
<?xml version="1.0" encoding="iso-8859-1" ?>
|
||||||
<races>
|
<races>
|
||||||
<race name="kraken" magres="0.000000" maxaura="0.000000" regaura="0.000000" recruitcost="50" weight="500" capacity="200" speed="2.000000" hp="300" damage="2d10" unarmedattack="0" unarmeddefense="0" attackmodifier="7" defensemodifier="7" coastal="yes" swim="yes" teach="no" giveitem="yes" getitem="yes">
|
<race name="kraken" magres="0.000000" maxaura="0.000000" regaura="0.000000" recruitcost="50" weight="500" capacity="200" speed="2.000000" hp="300" damage="2d10" unarmedattack="0" unarmeddefense="0" attackmodifier="7" defensemodifier="7" coastal="yes" swim="yes" teach="no" giveitem="yes" getitem="yes">
|
||||||
<ai splitsize="5000"/>
|
<ai splitsize="5000"/>
|
||||||
|
|
Loading…
Reference in New Issue