forked from github/server
antimagiekristallfix
This commit is contained in:
parent
41f17d9df7
commit
f2f09674cf
|
@ -554,6 +554,10 @@ create_curse(unit *magician, attrib **ap, curse_t id, int id2, int vigour,
|
||||||
int duration, int effect, int men)
|
int duration, int effect, int men)
|
||||||
{
|
{
|
||||||
curse *c;
|
curse *c;
|
||||||
|
|
||||||
|
/* die Kraft eines Spruchs darf nicht 0 sein*/
|
||||||
|
assert(vigour >= 0);
|
||||||
|
|
||||||
c = get_curse(*ap, id, id2);
|
c = get_curse(*ap, id, id2);
|
||||||
|
|
||||||
if(c && (c->flag & CURSE_ONLYONE)){
|
if(c && (c->flag & CURSE_ONLYONE)){
|
||||||
|
@ -709,6 +713,9 @@ is_cursed(attrib *ap, curse_t id, int id2)
|
||||||
if (c->flag & CURSE_ISNEW)
|
if (c->flag & CURSE_ISNEW)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
|
if (c->vigour <= 0)
|
||||||
|
return false;
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -805,22 +805,44 @@ use_antimagiccrystal(region * r, unit * mage, int amount, strlist * cmdstrings)
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
for (i=0;i!=amount;++i) {
|
for (i=0;i!=amount;++i) {
|
||||||
int effect, power, duration = 2;
|
int effect, force, duration = 2;
|
||||||
spell *sp = find_spellbyid(SPL_ANTIMAGICZONE);
|
spell *sp = find_spellbyid(SPL_ANTIMAGICZONE);
|
||||||
|
attrib ** ap = &r->attribs;
|
||||||
unused(cmdstrings);
|
unused(cmdstrings);
|
||||||
|
|
||||||
/* Reduziert die Stärke jedes Spruchs um effect */
|
/* Reduziert die Stärke jedes Spruchs um effect */
|
||||||
effect = sp->level*4; /* Stufe 5 =~ 15 */
|
effect = sp->level;
|
||||||
|
|
||||||
/* Hält Sprüche bis zu einem summierten Gesamtlevel von power aus.
|
/* Hält Sprüche bis zu einem summierten Gesamtlevel von power aus.
|
||||||
* Jeder Zauber reduziert die 'Lebenskraft' (vigour) der Antimagiezone
|
* Jeder Zauber reduziert die 'Lebenskraft' (vigour) der Antimagiezone
|
||||||
* um seine Stufe */
|
* um seine Stufe */
|
||||||
power = sp->level * 20; /* Stufe 5 =~ 100 */
|
force = sp->level * 20; /* Stufe 5 =~ 100 */
|
||||||
|
|
||||||
power = destroy_curse(&r->attribs, effect, power, NULL);
|
/* Regionszauber auflösen */
|
||||||
|
while (*ap && force > 0) {
|
||||||
|
curse * c;
|
||||||
|
attrib * a = *ap;
|
||||||
|
if (!fval(a->type, ATF_CURSE)) {
|
||||||
|
do { ap = &(*ap)->next; } while (*ap && a->type==(*ap)->type);
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
c = (curse*)a->data.v;
|
||||||
|
|
||||||
if(power) {
|
/* Immunität prüfen */
|
||||||
create_curse(mage, &r->attribs, C_ANTIMAGICZONE, 0, power, duration, effect, 0);
|
if (c->flag & CURSE_IMMUN) {
|
||||||
|
do { ap = &(*ap)->next; } while (*ap && a->type==(*ap)->type);
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
force = destr_curse(c, effect, force);
|
||||||
|
if(c->vigour <= 0) {
|
||||||
|
a_remove(ap, a);
|
||||||
|
}
|
||||||
|
if(*ap) ap = &(*ap)->next;
|
||||||
|
}
|
||||||
|
|
||||||
|
if(force) {
|
||||||
|
create_curse(mage, &r->attribs, C_ANTIMAGICZONE, 0, force, duration, effect, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -332,6 +332,43 @@ magicanalyse_ship(ship *sh, unit *mage, int force)
|
||||||
/* ------------------------------------------------------------- */
|
/* ------------------------------------------------------------- */
|
||||||
/* Antimagie - curse auflösen */
|
/* Antimagie - curse auflösen */
|
||||||
/* ------------------------------------------------------------- */
|
/* ------------------------------------------------------------- */
|
||||||
|
|
||||||
|
/* Wenn der Curse schwächer ist als der cast_level, dann wird er
|
||||||
|
* aufgelöst, bzw seine Kraft (vigour) auf 0 gesetzt.
|
||||||
|
* Ist der cast_level zu gering, hat die Antimagie nur mit einer Chance
|
||||||
|
* von 100-20*Stufenunterschied % eine Wirkung auf den Curse. Dann wird
|
||||||
|
* die Kraft des Curse um die halbe Stärke der Antimagie reduziert.
|
||||||
|
* Zurückgegeben wird der noch unverbrauchte Rest von force.
|
||||||
|
*/
|
||||||
|
int
|
||||||
|
destr_curse(curse* c, int cast_level, int force)
|
||||||
|
{
|
||||||
|
if (cast_level < c->vigour) { /* Zauber ist nicht stark genug */
|
||||||
|
int chance;
|
||||||
|
/* pro Stufe Unterschied -20% */
|
||||||
|
chance = (10 + (cast_level - c->vigour)*2);
|
||||||
|
if(rand()%10 >= chance){
|
||||||
|
force -= c->vigour;
|
||||||
|
if (c->type->change_vigour){
|
||||||
|
c->type->change_vigour(c, -(cast_level+1/2));
|
||||||
|
} else {
|
||||||
|
c->vigour -= cast_level+1/2;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} else { /* Zauber ist stärker als curse */
|
||||||
|
if (force >= c->vigour){ /* reicht die Kraft noch aus? */
|
||||||
|
force -= c->vigour;
|
||||||
|
if (c->type->change_vigour){
|
||||||
|
c->type->change_vigour(c, -c->vigour);
|
||||||
|
} else {
|
||||||
|
c->vigour = 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return force;
|
||||||
|
}
|
||||||
|
|
||||||
int
|
int
|
||||||
destroy_curse(attrib **alist, int cast_level, int force,
|
destroy_curse(attrib **alist, int cast_level, int force,
|
||||||
const curse_type * ctype)
|
const curse_type * ctype)
|
||||||
|
@ -355,29 +392,19 @@ destroy_curse(attrib **alist, int cast_level, int force,
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(!ctype || c->type==ctype) { /* wirkt auf alle */
|
/* Wenn kein spezieller cursetyp angegeben ist, soll die Antimagie
|
||||||
if (cast_level < c->vigour) { /* Zauber ist nicht stark genug */
|
* auf alle Verzauberungen wirken. Ansonsten prüfe, ob der Curse vom
|
||||||
int chance;
|
* richtigen Typ ist. */
|
||||||
/* pro Stufe Unterschied -20% */
|
if(!ctype || c->type==ctype) {
|
||||||
chance = (10 + (cast_level - c->vigour)*2);
|
int n;
|
||||||
if(rand()%10 >= chance){
|
n = destr_curse(c, cast_level, force);
|
||||||
if (c->type->change_vigour)
|
if (n != force){
|
||||||
c->type->change_vigour(c, -2);
|
assert(n<force); /* force darf sich nur vermindert haben */
|
||||||
force -= c->vigour;
|
succ = cast_level;
|
||||||
c->vigour -= 2;
|
force = n;
|
||||||
if(c->vigour <= 0) {
|
}
|
||||||
a_remove(alist, a);
|
if(c->vigour <= 0) {
|
||||||
}
|
a_remove(ap, a);
|
||||||
succ = cast_level;
|
|
||||||
}
|
|
||||||
} else { /* Zauber ist stärker als curse */
|
|
||||||
if (force >= c->vigour){ /* reicht die Kraft noch aus? */
|
|
||||||
force -= c->vigour;
|
|
||||||
if (c->type->change_vigour)
|
|
||||||
c->type->change_vigour(c, -c->vigour);
|
|
||||||
a_remove(alist, a);
|
|
||||||
succ = cast_level;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if(*ap) ap = &(*ap)->next;
|
if(*ap) ap = &(*ap)->next;
|
||||||
|
|
|
@ -213,7 +213,8 @@ int use_item_power(struct region * r, struct unit * u);
|
||||||
int use_item_regeneration(struct region * r, struct unit * u);
|
int use_item_regeneration(struct region * r, struct unit * u);
|
||||||
void showspells(struct region *r, struct unit *u);
|
void showspells(struct region *r, struct unit *u);
|
||||||
int sp_antimagiczone(struct castorder *co);
|
int sp_antimagiczone(struct castorder *co);
|
||||||
int destroy_curse(struct attrib **alist, int cast_level, int force, const struct curse_type * ctype);
|
int destr_curse(struct curse* c, int cast_level, int force);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/* Kampfzauber */
|
/* Kampfzauber */
|
||||||
|
|
16
src/katze.mk
16
src/katze.mk
|
@ -3,19 +3,17 @@ ifndef ERESSEA
|
||||||
export ERESSEA=$(PWD)
|
export ERESSEA=$(PWD)
|
||||||
endif
|
endif
|
||||||
|
|
||||||
# CONVERT_TRIGGERS = 1
|
|
||||||
|
|
||||||
# Hier definieren, damit nicht '@gcc'
|
# Hier definieren, damit nicht '@gcc'
|
||||||
CC = gcc -DNEW_RESOURCEGROWTH
|
#CC = gcc -DNEW_RESOURCEGROWTH
|
||||||
|
CC = gcc-3.0 -D_GNU_SOURCE
|
||||||
|
DEPEND = @gcc-3.0 -MM -MG -r
|
||||||
|
|
||||||
AR = ar
|
AR = ar
|
||||||
CTAGS = ctags
|
CTAGS = ctags-exuberant
|
||||||
CC = gcc
|
LD = gcc-3.0
|
||||||
LD = gcc
|
|
||||||
INSTALL = cp
|
INSTALL = cp
|
||||||
|
|
||||||
CFLAGS += -DNEW_RESOURCEGROWTH
|
CFLAGS += -minline-all-stringops
|
||||||
|
|
||||||
# CFLAGS += -Wshadow
|
|
||||||
|
|
||||||
# Ps = 0 -> Normal (default)
|
# Ps = 0 -> Normal (default)
|
||||||
# Ps = 1 -> Bold
|
# Ps = 1 -> Bold
|
||||||
|
|
Loading…
Reference in New Issue