diff --git a/kod/object/item.kod b/kod/object/item.kod index 542ec20f0f..2a490f751a 100644 --- a/kod/object/item.kod +++ b/kod/object/item.kod @@ -128,7 +128,12 @@ classvars: properties: viObject_flags = OF_GETTABLE + + // Item hits set initially. Shouldn't change afterwards. piHits_init = 0 + // Maximum hits for the item. Can change via low spellpower mends etc. + piHits_max = 0 + // Current hits for the item. Item breaks when this reaches 0. piHits = 0 plItem_attributes = $ @@ -146,6 +151,7 @@ messages: local iHits_average, oItemAtt; piHits_init = Random(viHits_init_min,viHits_init_max); + piHits_max = piHits_init; piHits = piHits_init; if corpse <> $ { @@ -837,15 +843,15 @@ messages: local iHit_Percent, rItem_condition; if vbShow_Condition - AND piHits_init > 0 + AND piHits_max > 0 { rItem_condition = vrCondition_exc; - iHit_Percent = (100 * piHits) / piHits_init; + iHit_Percent = (100 * piHits) / piHits_max; if iHit_Percent > 90 { - // If item is worse than what can be found in the wild, describe it - // as being "patched". - if piHits_init >= viHits_init_min + // If the item max hits is lower than the initial hits, describe it + // as being "patched". + if piHits_max >= piHits_init { rItem_condition = vrCondition_exc; } @@ -872,7 +878,7 @@ messages: } AddPacket(4,item_cond_master, 4,vrPoss_Article, 4,Send(self,@GetName), - 4,rItem_condition,4,piHits,4,piHits_init); + 4,rItem_condition,4,piHits,4,piHits_max); } else { @@ -939,16 +945,16 @@ messages: // Y = viHits_init_max (max_hits before casting 'mend') // X = viAverage_value // - // Translated: An item whose piInit_hits is 80// of viHits_init_max + // Translated: An item whose piHits_max is 80% of viHits_init_max // and whose piHits is equal to that amount has a value equal - // to 64// of its standard value. + // to 64% of its standard value. - iPercent = (100*piHits_init*piHits)/(viHits_init_max*viHits_init_max); + iPercent = (100 * piHits_max * piHits) / (viHits_init_max * viHits_init_max); iValue = Send(self,@GetInitValue); - - iFinal = (iValue * iPercent)/100; - iFinal = bound(iFinal,10,iValue); - + + iFinal = (iValue * iPercent) / 100; + iFinal = Bound(iFinal,10,iValue); + foreach i in plItem_Attributes { iNum = Send(self,@GetNumFromCompound,#compound=First(i)); @@ -960,11 +966,18 @@ messages: return iFinal; } - GetMaxHits() + GetInitHits() + "The item's initial max hits. Keep track of it separately " + "as max hits may change." { return piHits_init; } + GetMaxHits() + { + return piHits_max; + } + GetHits() { return piHits; @@ -977,9 +990,9 @@ messages: return; } - piHits_init = number; + piHits_max = number; - return; + return; } SetHits(number = $) @@ -994,6 +1007,17 @@ messages: return; } + FixMaxHits() + { + if (piHits_init > 0 + AND piHits_max = 0) + { + piHits_max = piHits_init; + } + + return; + } + NewOwner(what = $) { local lData; diff --git a/kod/object/item/passitem/weapon.kod b/kod/object/item/passitem/weapon.kod index 6fa464b451..343671cdf1 100644 --- a/kod/object/item/passitem/weapon.kod +++ b/kod/object/item/passitem/weapon.kod @@ -165,16 +165,19 @@ messages: if viWeaponQuality = WEAPON_QUALITY_LOW { piHits_init = piHits_init + WEAPON_LOW_QUALITY_HITS; + piHits_max = piHits_max + WEAPON_LOW_QUALITY_HITS; piHits = piHits + WEAPON_LOW_QUALITY_HITS; } else if viWeaponQuality = WEAPON_QUALITY_HIGH { piHits_init = piHits_init + WEAPON_HIGH_QUALITY_HITS; + piHits_max = piHits_max + WEAPON_HIGH_QUALITY_HITS; piHits = piHits + WEAPON_HIGH_QUALITY_HITS; } else if viWeaponQuality = WEAPON_NERUDITE { piHits_init = piHits_init + WEAPON_NERUDITE_HITS; + piHits_max = piHits_max + WEAPON_NERUDITE_HITS; piHits = piHits + WEAPON_NERUDITE_HITS; } diff --git a/kod/object/item/passitem/weapon/ranged.kod b/kod/object/item/passitem/weapon/ranged.kod index 26a590b4e4..14df6af5f4 100644 --- a/kod/object/item/passitem/weapon/ranged.kod +++ b/kod/object/item/passitem/weapon/ranged.kod @@ -160,7 +160,7 @@ messages: } else { - hit_roll = hit_roll + ((viHit_roll_modifier * piHits) / piHits_Init); + hit_roll = hit_roll + ((viHit_roll_modifier * piHits) / piHits_max); } iWeapHit = hit_roll; diff --git a/kod/object/passive/itematt/iadurabl.kod b/kod/object/passive/itematt/iadurabl.kod index 4d3e9daa1f..f5556fc16f 100644 --- a/kod/object/passive/itematt/iadurabl.kod +++ b/kod/object/passive/itematt/iadurabl.kod @@ -70,8 +70,10 @@ messages: iHits = Send(oItem,@GetMaxHits); iHits = (iHits * state1)/100; - iHits = bound(iHits,1,$); - Send(oItem,@setMaxHits,#number=iHits); + iHits = Bound(iHits,1,$); + + // Sets max hits, not initial. + Send(oItem,@SetMaxHits,#number=iHits); Send(oItem,@SetHits,#number=Send(oItem,@GetMaxHits)); return; diff --git a/kod/object/passive/spell.kod b/kod/object/passive/spell.kod index 2f902c4618..749d097027 100644 --- a/kod/object/passive/spell.kod +++ b/kod/object/passive/spell.kod @@ -329,7 +329,7 @@ messages: rOutlaw = spell_outlaw; } - rExtra = Send(self,@GetExtraDesc); + rExtra = Send(self,@GetExtraDesc,#who=who); AddPacket(4,spell_desc_rsc, 4,rSchool, 4,viSpell_Level, 4,vrDesc, 4,rOutlaw, 4,rExtra); diff --git a/kod/object/passive/spell/itemench/mend.kod b/kod/object/passive/spell/itemench/mend.kod index bd0eb4da14..19a254128a 100644 --- a/kod/object/passive/spell/itemench/mend.kod +++ b/kod/object/passive/spell/itemench/mend.kod @@ -24,7 +24,9 @@ resources: "Erases the wear of battle from a piece of equipment, restoring it to " "near new condition. " "Requires an orc tooth and a sapphire to cast." - + mend_extradesc_rsc = \ + "\n\nIf you mend an item while immortal, the item will be " + "returned to its original condition." mend_not_weaponry = "You try to focus on %s%s, but nothing happens!" mend_beyond_hope = "%s%s is beyond salvage." mend_full_healed = "%s%s is already in perfect condition." @@ -37,6 +39,7 @@ classvars: vrName = mend_name_rsc vrIcon = mend_icon_rsc vrDesc = mend_desc_rsc + vrExtraDesc = mend_extradesc_rsc viSpell_num = SID_MEND viSchool = SS_KRAANAN @@ -124,23 +127,35 @@ messages: { // Immortals heal items back up to full. iMultiplier = 100; + iAmount = Send(oTarget,@GetInitHits); } else { - // Multiplier is a number from 75// to 95//. - iMultiplier = 75 + iSpellpower/5; - iMultiplier = bound(iMultiplier,75,95); + // Multiplier is a number from 75% to 95%. + iMultiplier = 75 + iSpellpower / 5; + iMultiplier = Bound(iMultiplier,75,95); } - iAmount = (iAmount*iMultiplier)/100; + iAmount = (iAmount * iMultiplier) / 100; Send(oTarget,@SetMaxHits,#number=iAmount); Send(oTarget,@SetHits,#number=iAmount); Send(who,@MsgSendUser,#message_rsc=mend_working, - #parm1=Send(oTarget,@GetDef),#parm2=Send(oTarget,@GetName)); + #parm1=Send(oTarget,@GetDef),#parm2=Send(oTarget,@GetName)); + + propagate; + } + + GetExtraDesc(who=$) + { + if (who <> $ + AND IsClass(who,&DM)) + { + return vrExtraDesc; + } propagate; } end -//////////////////////////////////////////////////////////////////////////////// \ No newline at end of file +//////////////////////////////////////////////////////////////////////////////// diff --git a/kod/object/passive/spell/itemench/mend.lkod b/kod/object/passive/spell/itemench/mend.lkod index cccf3e8790..3dbec1c630 100644 --- a/kod/object/passive/spell/itemench/mend.lkod +++ b/kod/object/passive/spell/itemench/mend.lkod @@ -2,6 +2,9 @@ mend_name_rsc = de "Reparieren" mend_desc_rsc = de \ "Beseitigt die Spuren vieler Kämpfe von einem Teil der Ausrüstung und " "stellt sie fast völlig wieder her. Der Zauber benötigt einen Orkzahn und einen Saphir." +mend_extradesc_rsc = de \ + "\n\nWenn du als Unsterblicher einen Gegenstand reparierst, ist dieser " + "wieder in seinem ursprünglichen Zustand." mend_not_weaponry = de \ "%s%s reparieren? Das geht leider nicht." mend_beyond_hope = de "%s%s kann nicht mehr repariert werden."