A few more item abilities

- Weapon ability that drains spell points (works at both melee and range)
- Armor abilities that boost groups of stats - one for all combat stats, one for all magic stats
- Item ability that occasionally increases light level when it's dark (works even in towns with no light)
- Renumber the usable abilities to fill in gaps
- Usable light ability can now decrease light as well as increase
This commit is contained in:
2015-01-20 23:59:15 -05:00
parent 74ed88f2f3
commit 53677398de
7 changed files with 93 additions and 19 deletions

View File

@@ -2310,6 +2310,16 @@ void increase_age() {
}
}
if(univ.town->lighting_type != LIGHT_NORMAL) {
int radiance = 0;
for(int i = 0; i < 6; i++)
radiance += univ.party[i].get_prot_level(eItemAbil::RADIANT);
if(radiance > 0 && univ.party.light_level < radiance && get_ran(1,1,10) < radiance) {
ASB("One of your items is glowing softly!");
univ.party.light_level += radiance * 3;
}
}
// Specials countdowns
if(univ.party.age % 500 == 0 && univ.party.has_abil(eItemAbil::OCCASIONAL_STATUS)) {
// TODO: There used to be a "display strings" here; should we hook in a special node call?

View File

@@ -791,6 +791,18 @@ void pc_attack_weapon(short who_att,short target,short hit_adj,short dam_adj,cIt
} else if(weap.ability == eItemAbil::SOULSUCKER && get_ran(1,0,1) == 1) {
add_string_to_buf(" Blade drains life.");
heal_pc(who_att,weap.abil_data[0] / 2);
} else if(weap.ability == eItemAbil::ANTIMAGIC_WEAPON && which_m->mu + which_m->cl > 0 && get_ran(1,0,1) == 1) {
short drain = weap.abil_data[0];
magic_adjust(which_m, &drain);
if(drain > 0) {
add_string_to_buf(" Blade drains energy.");
if(which_m->mu > 0 && which_m->mp > 4)
drain = min(which_m->mp, drain / 3);
else if(which_m->cl > 0 && which_m->mp > 10)
drain = min(which_m->mp, drain / 2);
which_m->mp -= drain;
restore_sp_pc(who_att, drain / 3);
}
} else if(weap.ability == eItemAbil::WEAPON_CALL_SPECIAL) {
short s1,s2,s3;
univ.party.force_ptr(21, 301, 5);
@@ -824,7 +836,9 @@ short calc_spec_dam(eItemAbil abil,short abil_str,short abil_dat,cCreature* mons
else dmg_type = eDamageType::FIRE;
break;
case eItemAbil::SLAYER_WEAPON:
if(monst->m_type != eRace(abil_dat))
// Slith, nephilim, and vahnatai are affected by humanoid-bane weapons as well as their individual banes
if(abil_dat == int(eRace::HUMANOID) && (monst->m_type == eRace::SLITH || monst->m_type == eRace::NEPHIL || monst->m_type == eRace::VAHNATAI));
else if(monst->m_type != eRace(abil_dat))
break;
store += abil_str;
switch(eRace(abil_dat)) {
@@ -1647,6 +1661,18 @@ void fire_missile(location target) {
} else if(missile.ability == eItemAbil::SOULSUCKER && get_ran(1,0,1) == 1) {
add_string_to_buf(" Missile drains life.");
heal_pc(missile_firer,missile.abil_data[0] / 2);
} else if(missile.ability == eItemAbil::ANTIMAGIC_WEAPON && cur_monst->mu + cur_monst->cl > 0 && get_ran(1,0,1) == 1) {
short drain = missile.abil_data[0];
magic_adjust(cur_monst, &drain);
if(drain > 0) {
add_string_to_buf(" Missile drains energy.");
if(cur_monst->mu > 0 && cur_monst->mp > 4)
drain = min(cur_monst->mp, drain / 3);
else if(cur_monst->cl > 0 && cur_monst->mp > 10)
drain = min(cur_monst->mp, drain / 2);
cur_monst->mp -= drain;
restore_sp_pc(missile_firer, drain / 3);
}
}
if(cur_monst->abil[eMonstAbil::HIT_TRIGGER].active) {
short s1,s2,s3;
@@ -1681,6 +1707,20 @@ void fire_missile(location target) {
} else if(missile.ability == eItemAbil::SOULSUCKER && get_ran(1,0,1) == 1) {
add_string_to_buf(" Missile drains life.");
heal_pc(missile_firer,missile.abil_data[0] / 2);
} else if(missile.ability == eItemAbil::ANTIMAGIC_WEAPON &&
univ.party[targ_monst].skill(eSkill::MAGE_SPELLS) + univ.party[targ_monst].skill(eSkill::PRIEST_SPELLS) > 0 &&
get_ran(1,0,1) == 1) {
short drain = missile.abil_data[0];
magic_adjust(cur_monst, &drain);
if(drain > 0) {
add_string_to_buf(" Missile drains energy.");
if(univ.party[targ_monst].skill(eSkill::MAGE_SPELLS) > 0 && univ.party[targ_monst].cur_sp > 4)
drain = min(univ.party[targ_monst].cur_sp, drain / 3);
else if(univ.party[targ_monst].skill(eSkill::PRIEST_SPELLS) > 0 && univ.party[targ_monst].cur_sp > 10)
drain = min(univ.party[targ_monst].cur_sp, drain / 2);
univ.party[targ_monst].cur_sp -= drain;
restore_sp_pc(missile_firer, drain / 3);
}
} else if(missile.ability == eItemAbil::WEAPON_CALL_SPECIAL) {
short s1,s2,s3;
univ.party.force_ptr(21, 301, 5);
@@ -1829,6 +1869,16 @@ void combat_run_monst() {
if(univ.town->lighting_type == 3)
univ.party.light_level = 0;
if(univ.town->lighting_type != LIGHT_NORMAL) {
int radiance = 0;
for(int i = 0; i < 6; i++)
radiance += univ.party[i].get_prot_level(eItemAbil::RADIANT);
if(radiance > 0 && univ.party.light_level < radiance && get_ran(1,1,10) < radiance) {
ASB("One of your items is glowing softly!");
univ.party.light_level += radiance * 3;
}
}
move_to_zero(univ.party.status[ePartyStatus::DETECT_LIFE]);
move_to_zero(univ.party.status[ePartyStatus::FIREWALK]);

View File

@@ -1102,8 +1102,7 @@ void do_priest_spell(short pc_num,eSpell spell_num,bool freebie) {
case eSpell::LIGHT_DIVINE:
if(!freebie)
univ.party[pc_num].cur_sp -= (*spell_num).cost;
// TODO: Should this call increase_light_level?
univ.party.light_level += 210;
increase_light(210);
break;
case eSpell::SUMMON_SPIRIT:

View File

@@ -1010,8 +1010,13 @@ void use_item(short pc,short item) {
}
break;
case eItemAbil::LIGHT:
ASB(" You have more light.");
increase_light(50 * str);
if(type % 2 == 0) {
ASB(" You have more light.");
increase_light(50 * str);
} else {
ASB(" It gets darker.");
increase_light(-50 & str);
}
break;
case eItemAbil::AFFECT_PARTY_STATUS:
switch(ePartyStatus(univ.party[pc].items[item].abil_data[1])) {

View File

@@ -642,6 +642,7 @@ void cItem::append(legacy::item_record_type& old){
break;
case 90:
ability = eItemAbil::LIGHT;
magic_use_type = 2;
break;
case 91:
ability = eItemAbil::AFFECT_PARTY_STATUS;

View File

@@ -288,7 +288,12 @@ short cPlayer::has_abil(eItemAbil abil,short dat) {
}
short cPlayer::skill(eSkill skill) {
return min(20, skills[skill] + get_prot_level(eItemAbil::BOOST_STAT, int(skill)));
int bulk_bonus = 0;
if(skill >= eSkill::EDGED_WEAPONS && skill <= eSkill::DEFENSE)
bulk_bonus = get_prot_level(eItemAbil::BOOST_WAR);
else if(skill >= eSkill::MAGE_SPELLS && skill <= eSkill::ITEM_LORE)
bulk_bonus = get_prot_level(eItemAbil::BOOST_MAGIC);
return min(20, skills[skill] + get_prot_level(eItemAbil::BOOST_STAT, int(skill))) + bulk_bonus;
}
eBuyStatus cPlayer::ok_to_buy(short cost,cItem item) {

View File

@@ -326,6 +326,7 @@ enum class eItemAbil {
RETURNING_MISSILE = 5,
DISTANCE_MISSILE = 6,
SEEKING_MISSILE = 7,
ANTIMAGIC_WEAPON = 8,
STATUS_WEAPON = 9,
SOULSUCKER = 10,
DRAIN_MISSILES = 11,
@@ -342,6 +343,8 @@ enum class eItemAbil {
STATUS_PROTECTION = 36,
SKILL = 37,
BOOST_STAT = 38,
BOOST_WAR = 39,
BOOST_MAGIC = 40,
ACCURACY = 41,
THIEVING = 42,
GIANT_STRENGTH = 43,
@@ -353,27 +356,28 @@ enum class eItemAbil {
PROTECT_FROM_PETRIFY = 49,
REGENERATE = 50,
POISON_AUGMENT = 51,
RADIANT = 52,
WILL = 53,
FREE_ACTION = 54,
SPEED = 55,
SLOW_WEARER = 56,
PROTECT_FROM_SPECIES = 57,
// Nonspell Usable
// Usable
POISON_WEAPON = 70, //put poison on weapon
AFFECT_STATUS = 71,
CAST_SPELL = 72,
BLISS_DOOM = 84,
AFFECT_EXPERIENCE = 85,
AFFECT_SKILL_POINTS = 86,
AFFECT_HEALTH = 87,
AFFECT_SPELL_POINTS = 88,
LIGHT = 90,
AFFECT_PARTY_STATUS = 91,
HEALTH_POISON = 94,
CALL_SPECIAL = 95,
SUMMONING = 119,
MASS_SUMMONING = 120,
QUICKFIRE = 129,
BLISS_DOOM = 73,
AFFECT_EXPERIENCE = 74,
AFFECT_SKILL_POINTS = 75,
AFFECT_HEALTH = 76,
AFFECT_SPELL_POINTS = 77,
LIGHT = 78,
AFFECT_PARTY_STATUS = 79,
HEALTH_POISON = 80,
CALL_SPECIAL = 81,
SUMMONING = 82,
MASS_SUMMONING = 83,
QUICKFIRE = 84,
// Reagents
HOLLY = 150, // Holly/Toadstool
COMFREY = 151, // Comfrey Root