Separate "Splits When Hit" from "Immune to Assassinate"
This commit is contained in:
@@ -15,6 +15,7 @@
|
||||
<text top='246' left='273' width='40' height='16'>Poison:</text>
|
||||
<field name='poison-res' top='245' left='320' width='80' height='16'/>
|
||||
<led name='mindless' top='215' left='415' width='70'>Mindless</led>
|
||||
<led name='amorph' top='230' left='415' width='70'>Amorphous</led>
|
||||
<led name='invuln' top='245' left='415' width='70'>Invulnerable</led>
|
||||
<pict type='dlog' num='16' top='8' left='8'/>
|
||||
<text size='large' top='6' left='50' width='158' height='16'>Edit Monster Abilities</text>
|
||||
|
@@ -372,6 +372,7 @@
|
||||
<xs:element name="demon" type="xs:integer" minOccurs="0"/>
|
||||
<xs:element name="all" type="bool" minOccurs="0"/>
|
||||
<xs:element name="fear" type="bool" minOccurs="0"/>
|
||||
<xs:element name="assassinate" type="bool" minOccurs="0"/>
|
||||
</xs:all>
|
||||
</xs:complexType>
|
||||
</xs:element>
|
||||
|
@@ -765,7 +765,7 @@ void pc_attack_weapon(short who_att,iLiving& target,short hit_adj,short dam_adj,
|
||||
if(primary) {
|
||||
bool splits = false;
|
||||
if(cCreature* who = dynamic_cast<cCreature*>(&target))
|
||||
splits = who->abil[eMonstAbil::SPLITS].active;
|
||||
splits = who->amorphous;
|
||||
// assassinate
|
||||
r1 = get_ran(1,1,100);
|
||||
int assassin = univ.party[who_att].skill(eSkill::ASSASSINATION);
|
||||
|
@@ -279,6 +279,7 @@ std::map<eMonstAbil,uAbility>::iterator cMonster::addAbil(eMonstAbilTemplate wha
|
||||
// Misc abilities
|
||||
case eMonstAbilTemplate::SPLITS:
|
||||
abil[eMonstAbil::SPLITS].special = {true, 1000, 0, 0};
|
||||
amorphous = true;
|
||||
return abil.find(eMonstAbil::SPLITS);
|
||||
case eMonstAbilTemplate::MARTYRS_SHIELD:
|
||||
abil[eMonstAbil::MARTYRS_SHIELD].special = {true, 1000, 100, 0};
|
||||
@@ -386,7 +387,7 @@ cMonster::cMonster(){
|
||||
}
|
||||
// And just in case something weird happens:
|
||||
resist[eDamageType::MARKED] = 100;
|
||||
mindless = invuln = guard = invisible = false;
|
||||
amorphous = mindless = invuln = guard = invisible = false;
|
||||
level = m_health = armor = skill = 0;
|
||||
speed = 4;
|
||||
default_facial_pic = 0;
|
||||
|
@@ -110,7 +110,7 @@ public:
|
||||
item_num_t corpse_item;
|
||||
short corpse_item_chance;
|
||||
std::map<eDamageType, int> resist;
|
||||
bool mindless, invuln, invisible, guard;
|
||||
bool mindless, invuln, invisible, guard, amorphous;
|
||||
unsigned int x_width,y_width;
|
||||
eAttitude default_attitude;
|
||||
unsigned int summon_type;
|
||||
|
@@ -875,6 +875,8 @@ static void put_monst_abils_in_dlog(cDialog& me, cMonster& monst) {
|
||||
me["onsee"].setTextToNum(monst.see_spec);
|
||||
me["snd"].setTextToNum(monst.ambient_sound);
|
||||
|
||||
if(monst.amorphous)
|
||||
dynamic_cast<cLed&>(me["amorph"]).setState(led_red);
|
||||
if(monst.mindless)
|
||||
dynamic_cast<cLed&>(me["mindless"]).setState(led_red);
|
||||
if(monst.invuln)
|
||||
@@ -939,6 +941,7 @@ static bool save_monst_abils(cDialog& me, cMonster& monst) {
|
||||
monst.see_spec = me["onsee"].getTextAsNum();
|
||||
monst.ambient_sound = me["snd"].getTextAsNum();
|
||||
|
||||
monst.amorphous = dynamic_cast<cLed&>(me["amorph"]).getState() != led_off;
|
||||
monst.mindless = dynamic_cast<cLed&>(me["mindless"]).getState() != led_off;
|
||||
monst.invuln = dynamic_cast<cLed&>(me["invuln"]).getState() != led_off;
|
||||
monst.invisible = dynamic_cast<cLed&>(me["invis"]).getState() != led_off;
|
||||
|
@@ -517,6 +517,7 @@ void writeMonstersToXml(ticpp::Printer&& data, cScenario& scenario) {
|
||||
data.PushElement(boost::lexical_cast<std::string>(dmg), monst.resist[dmg]);
|
||||
}
|
||||
if(monst.mindless) data.PushElement("fear", true);
|
||||
if(monst.amorphous) data.PushElement("assassinate", true);
|
||||
if(monst.invuln) data.PushElement("all", true);
|
||||
data.CloseElement("immunity");
|
||||
|
||||
|
@@ -1442,6 +1442,10 @@ void readMonstersFromXml(ticpp::Document&& data, cScenario& scenario) {
|
||||
resist->GetText(&val);
|
||||
if(val == "true")
|
||||
the_mon.mindless = true;
|
||||
} else if(type == "assassinate") {
|
||||
resist->GetText(&val);
|
||||
if(val == "true")
|
||||
the_mon.amorphous = true;
|
||||
} else try {
|
||||
eDamageType dmg = boost::lexical_cast<eDamageType>(type);
|
||||
resist->GetText(&the_mon.resist[dmg]);
|
||||
|
@@ -13,6 +13,7 @@
|
||||
<immunity>
|
||||
<all>true</all>
|
||||
<fear>true</fear>
|
||||
<assassinate>true</assassinate>
|
||||
<fire>10</fire>
|
||||
<cold>20</cold>
|
||||
<magic>30</magic>
|
||||
|
@@ -271,6 +271,7 @@ TEST_CASE("Converting monsters from legacy scenarios") {
|
||||
REQUIRE(new_monst.abil.size() == 1);
|
||||
REQUIRE(new_monst.abil[eMonstAbil::SPLITS].active);
|
||||
CHECK(new_monst.abil[eMonstAbil::SPLITS].special.extra1 == 1000);
|
||||
CHECK(new_monst.amorphous);
|
||||
}
|
||||
SECTION("Mindless") {
|
||||
old_monst.spec_skill = 13;
|
||||
|
@@ -156,6 +156,7 @@ TEST_CASE("Loading a monster type definition") {
|
||||
doc = xmlDocFromStream(fin, "immunity.xml");
|
||||
REQUIRE_NOTHROW(readMonstersFromXml(move(doc), scen));
|
||||
REQUIRE(scen.scen_monsters.size() >= 2);
|
||||
CHECK(scen.scen_monsters[1].amorphous);
|
||||
CHECK(scen.scen_monsters[1].mindless);
|
||||
CHECK(scen.scen_monsters[1].invuln);
|
||||
CHECK(scen.scen_monsters[1].resist[eDamageType::FIRE] == 10);
|
||||
|
@@ -97,6 +97,7 @@ TEST_CASE("Saving monster types") {
|
||||
scen.scen_monsters[1].treasure = 4;
|
||||
scen.scen_monsters[1].corpse_item = 128;
|
||||
scen.scen_monsters[1].corpse_item_chance = 35;
|
||||
scen.scen_monsters[1].amorphous = true;
|
||||
scen.scen_monsters[1].mindless = true;
|
||||
scen.scen_monsters[1].invuln = true;
|
||||
scen.scen_monsters[1].invisible = true;
|
||||
@@ -112,6 +113,7 @@ TEST_CASE("Saving monster types") {
|
||||
CHECK(scen.scen_monsters[1].treasure == 4);
|
||||
CHECK(scen.scen_monsters[1].corpse_item == 128);
|
||||
CHECK(scen.scen_monsters[1].corpse_item_chance == 35);
|
||||
CHECK(scen.scen_monsters[1].amorphous);
|
||||
CHECK(scen.scen_monsters[1].mindless);
|
||||
CHECK(scen.scen_monsters[1].invuln);
|
||||
CHECK(scen.scen_monsters[1].invisible);
|
||||
|
Reference in New Issue
Block a user