Merge branch 'feature/bug-2053-attack-monsters' of https://github.com/ennorehling/eressea into ennorehling-feature/bug-2053-attack-monsters

Conflicts:
	conf/e3/config.xml
This commit is contained in:
Enno Rehling 2015-09-19 13:35:53 +02:00
commit 84a92124bd
6 changed files with 14 additions and 22 deletions

View File

@ -55,7 +55,7 @@
"rules.migrants.max": 0,
"rules.reserve.twophase": true,
"rules.owners.force_leave": false,
"rules.monsters.attack_chance": 0.0,
"rules.monsters.attack_chance": 0.1,
"rules.transfermen": false,
"rules.stealth.faction": true,
"rules.stealth.anon_battle": false,

View File

@ -430,7 +430,7 @@
<attack type="1" damage="1d4"/>
<attack type="2" damage="2d20"/>
</race>
<race name="songdragon" magres="0.990000" maxaura="1.000000" regaura="1.000000" recruitcost="50" weight="1000" capacity="600" speed="1.500000" hp="40" ac="1" damage="2d4" unarmedattack="0" unarmeddefense="0" attackmodifier="3" defensemodifier="1" fly="yes" walk="yes" teach="no" getitem="yes">
<race name="songdragon" magres="0.990000" maxaura="1.000000" regaura="1.000000" recruitcost="50" weight="1000" capacity="600" speed="1.500000" hp="40" ac="1" damage="2d4" unarmedattack="0" unarmeddefense="0" attackmodifier="3" defensemodifier="1" fly="yes" walk="yes" teach="no" getitem="yes" unarmedguard="yes">
<ai splitsize="9999"/>
<function name="initfamiliar" value="oldfamiliars"/>
<skill name="alchemy" modifier="-99"/>
@ -733,7 +733,7 @@
<attack type="4" damage="2d12"/>
<attack type="4" damage="2d12"/>
</race>
<race name="wyrm" magres="0.900000" maxaura="1.000000" regaura="3.000000" recruitcost="250000" weight="18000" capacity="1000000" speed="1.000000" hp="2700" ac="8" damage="2d60" unarmedattack="0" unarmeddefense="0" attackmodifier="10" defensemodifier="10" scarepeasants="yes" fly="yes" walk="yes" teach="no" getitem="yes" resistbash="yes">
<race name="wyrm" magres="0.900000" maxaura="1.000000" regaura="3.000000" recruitcost="250000" weight="18000" capacity="1000000" speed="1.000000" hp="2700" ac="8" damage="2d60" unarmedattack="0" unarmeddefense="0" attackmodifier="10" defensemodifier="10" scarepeasants="yes" fly="yes" walk="yes" teach="no" getitem="yes" resistbash="yes" unarmedguard="yes">
<ai splitsize="1" killpeasants="yes" learn="yes"/>
<function name="name" value="namedragon"/>
<function name="move" value="movedragon"/>
@ -745,7 +745,7 @@
<attack type="4" damage="5d30"/>
<attack type="6" spell="powerful_dragonbreath" level="12" />
</race>
<race name="dragon" magres="0.700000" maxaura="1.000000" regaura="2.000000" recruitcost="50000" weight="10000" capacity="1000000" speed="1.500000" hp="900" ac="6" damage="2d30" unarmedattack="0" unarmeddefense="0" attackmodifier="7" defensemodifier="7" scarepeasants="yes" fly="yes" walk="yes" teach="no" getitem="yes" resistbash="yes">
<race name="dragon" magres="0.700000" maxaura="1.000000" regaura="2.000000" recruitcost="50000" weight="10000" capacity="1000000" speed="1.500000" hp="900" ac="6" damage="2d30" unarmedattack="0" unarmeddefense="0" attackmodifier="7" defensemodifier="7" scarepeasants="yes" fly="yes" walk="yes" teach="no" getitem="yes" resistbash="yes" unarmedguard="yes">
<ai splitsize="2" killpeasants="yes" learn="yes"/>
<function name="name" value="namedragon"/>
<function name="age" value="agedragon"/>
@ -758,7 +758,7 @@
<attack type="4" damage="3d30"/>
<attack type="6" spell="icy_dragonbreath" level="6" />
</race>
<race name="youngdragon" magres="0.500000" maxaura="1.000000" regaura="1.000000" recruitcost="10000" weight="20000" capacity="10000" speed="1.000000" hp="300" ac="4" damage="2d15" unarmedattack="0" unarmeddefense="0" attackmodifier="4" defensemodifier="4" scarepeasants="yes" fly="yes" walk="yes" teach="no" getitem="yes" resistbash="yes">
<race name="youngdragon" magres="0.500000" maxaura="1.000000" regaura="1.000000" recruitcost="10000" weight="20000" capacity="10000" speed="1.000000" hp="300" ac="4" damage="2d15" unarmedattack="0" unarmeddefense="0" attackmodifier="4" defensemodifier="4" scarepeasants="yes" fly="yes" walk="yes" teach="no" getitem="yes" resistbash="yes" unarmedguard="yes">
<ai splitsize="6" killpeasants="yes" learn="yes"/>
<function name="name" value="namedragon"/>
<function name="age" value="agefiredragon"/>
@ -1170,7 +1170,7 @@
<function name="name" value="namegeneric"/>
<attack type="1" damage="1d1"/>
</race>
<race name="seaserpent" magres="0.500000" maxaura="1.000000" regaura="1.000000" recruitcost="5000" weight="20000" capacity="5000" speed="1.000000" hp="600" ac="3" damage="2d15" unarmedattack="0" unarmeddefense="0" attackmodifier="4" defensemodifier="4" scarepeasants="yes" swim="yes" teach="no" getitem="yes" resistbash="yes">
<race name="seaserpent" magres="0.500000" maxaura="1.000000" regaura="1.000000" recruitcost="5000" weight="20000" capacity="5000" speed="1.000000" hp="600" ac="3" damage="2d15" unarmedattack="0" unarmeddefense="0" attackmodifier="4" defensemodifier="4" scarepeasants="yes" swim="yes" teach="no" getitem="yes" resistbash="yes" unarmedguard="yes">
<ai splitsize="6" killpeasants="yes" moverandom="yes" learn="yes"/>
<function name="name" value="namegeneric"/>
<function name="move" value="moveswimming"/>

View File

@ -175,8 +175,6 @@ race *rc_get_or_create(const char *zName)
assert(zName);
rc = rc_find_i(zName);
if (!rc) {
char zBuffer[80];
rc = (race *)calloc(sizeof(race), 1);
rc->hitpoints = 1;
rc->weight = PERSON_WEIGHT;
@ -189,8 +187,7 @@ race *rc_get_or_create(const char *zName)
log_error("race '%s' has an invalid name. remove spaces\n", zName);
assert(strchr(zName, ' ') == NULL);
}
strcpy(zBuffer, zName);
rc->_name = _strdup(zBuffer);
rc->_name = _strdup(zName);
rc->precombatspell = NULL;
rc->attack[0].type = AT_COMBATSPELL;

View File

@ -146,10 +146,8 @@ static void reduce_weight(unit * u)
static order *monster_attack(unit * u, const unit * target)
{
if (u->region != target->region)
return NULL;
if (u->faction == target->faction)
return NULL;
assert(u->region == target->region);
assert(u->faction != target->faction);
if (!cansee(u->faction, u->region, target, 0))
return NULL;
if (monster_is_waiting(u))
@ -167,7 +165,7 @@ static order *get_money_for_dragon(region * r, unit * u, int wanted)
if (attack_chance > 0.0 && is_guard(u, GUARD_TAX)) {
/* attackiere bewachende Einheiten nur wenn wir selbst schon bewachen */
for (u2 = r->units; u2; u2 = u2->next) {
if (u2 != u && is_guard(u2, GUARD_TAX)) {
if (u2 != u && is_guard(u2, GUARD_TAX) && u->faction!=u2->faction) {
/*In E3 + E4 etwas problematisch, da der Regionsbesitzer immer bewacht. Der Drache greift also immer die Burg an!*/
order *ord = monster_attack(u, u2);
if (ord)
@ -557,8 +555,7 @@ static void monster_attacks(unit * u)
unit *u2;
for (u2 = r->units; u2; u2 = u2->next) {
if (cansee(u->faction, r, u2, 0) && u2->faction != u->faction && inside_building(u2) != u->building
&& chance(0.75)) {
if (u2->faction != u->faction && cansee(u->faction, r, u2, 0) && !inside_building(u2)) {
order *ord = monster_attack(u, u2);
if (ord)
addlist(&u->orders, ord);

View File

@ -950,9 +950,7 @@ static bool is_guardian_r(const unit * guard)
if ((guard->flags & UFL_GUARD) == 0)
return false;
if (!armedmen(guard, true) && !fval(u_race(guard), RCF_UNARMEDGUARD))
return false;
return true;
return armedmen(guard, true) > 0 || fval(u_race(guard), RCF_UNARMEDGUARD);
}
bool is_guard(const struct unit * u, unsigned int mask)

View File

@ -6567,14 +6567,14 @@ static spelldata spell_functions[] = {
{ "analysedream", sp_analysedream, 0 },
{ "disturbingdreams", sp_disturbingdreams, 0 },
{ "sleep", sp_sleep, 0 },
{ "wisps", 0, 0 }, /* this spell is gone */
{ "wisps", 0, 0 }, /* TODO: this spell is gone */
{ "gooddreams", sp_gooddreams, 0 },
{ "illaundestroymagic", sp_destroy_magic, 0 },
{ "clone", sp_clonecopy, 0 },
{ "bad_dreams", sp_baddreams, 0 },
{ "mindblast", sp_mindblast_temp, 0 },
{ "orkdream", sp_sweetdreams, 0 },
{ "summon_alp", sp_summon_alp, 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 },