move bot backstab to mob

This commit is contained in:
nytmyr
2024-12-12 15:33:11 -06:00
parent 96bc292ad6
commit f44af609e1
4 changed files with 88 additions and 31 deletions
+65 -20
View File
@@ -709,54 +709,78 @@ int Mob::MonkSpecialAttack(Mob *other, uint8 unchecked_type)
}
void Mob::TryBackstab(Mob *other, int ReuseTime) {
if(!other)
if (!other) {
return;
}
bool bIsBehind = false;
bool bCanFrontalBS = false;
//make sure we have a proper weapon if we are a client.
if(IsClient()) {
if (IsClient()) {
const EQ::ItemInstance *wpn = CastToClient()->GetInv().GetItem(EQ::invslot::slotPrimary);
if (!wpn || (wpn->GetItem()->ItemType != EQ::item::ItemType1HPiercing)){
MessageString(Chat::Red, BACKSTAB_WEAPON);
return;
}
}
else if (IsBot()) {
const EQ::ItemInstance* inst = CastToBot()->GetBotItem(EQ::invslot::slotPrimary);
const EQ::ItemData* botpiercer = nullptr;
if (inst) {
botpiercer = inst->GetItem();
}
if (!botpiercer || (botpiercer->ItemType != EQ::item::ItemType1HPiercing)) {
if (!CastToBot()->GetCombatRoundForAlerts()) {
CastToBot()->SetCombatRoundForAlerts();
CastToBot()->BotGroupSay(this, "I can't backstab with this weapon!");
}
return;
}
}
//Live AA - Triple Backstab
int tripleChance = itembonuses.TripleBackstab + spellbonuses.TripleBackstab + aabonuses.TripleBackstab;
if (BehindMob(other, GetX(), GetY()))
if (BehindMob(other, GetX(), GetY())) {
bIsBehind = true;
}
else {
//Live AA - Seized Opportunity
int FrontalBSChance = itembonuses.FrontalBackstabChance + spellbonuses.FrontalBackstabChance + aabonuses.FrontalBackstabChance;
if (FrontalBSChance && zone->random.Roll(FrontalBSChance))
if (FrontalBSChance && zone->random.Roll(FrontalBSChance)) {
bCanFrontalBS = true;
}
}
if (bIsBehind || bCanFrontalBS || (IsNPC() && CanFacestab())) { // Player is behind other OR can do Frontal Backstab
if (bCanFrontalBS && IsClient()) // I don't think there is any message ...
CastToClient()->Message(Chat::White,"Your fierce attack is executed with such grace, your target did not see it coming!");
if (bCanFrontalBS && IsClient()) { // I don't think there is any message ...
CastToClient()->Message(Chat::White, "Your fierce attack is executed with such grace, your target did not see it coming!");
}
RogueBackstab(other,false,ReuseTime);
if (level >= RuleI(Combat, DoubleBackstabLevelRequirement)) {
// TODO: 55-59 doesn't appear to match just checking double attack, 60+ does though
if(IsClient() && CastToClient()->CheckDoubleAttack())
{
if(other->GetHP() > 0)
RogueBackstab(other,false,ReuseTime);
if(IsOfClientBot() && CastToClient()->CheckDoubleAttack()) {
if (other->GetHP() > 0) {
RogueBackstab(other, false, ReuseTime);
}
if (tripleChance && other->GetHP() > 0 && zone->random.Roll(tripleChance))
RogueBackstab(other,false,ReuseTime);
if (tripleChance && other->GetHP() > 0 && zone->random.Roll(tripleChance)) {
RogueBackstab(other, false, ReuseTime);
}
}
}
if(IsClient())
if (IsClient()) {
CastToClient()->CheckIncreaseSkill(EQ::skills::SkillBackstab, other, 10);
}
}
//Live AA - Chaotic Backstab
@@ -766,14 +790,20 @@ void Mob::TryBackstab(Mob *other, int ReuseTime) {
//we can stab from any angle, we do min damage though.
// chaotic backstab can't double etc Seized can, but that's because it's a chance to do normal BS
// Live actually added SPA 473 which grants chance to double here when they revamped chaotic/seized
RogueBackstab(other, true, ReuseTime);
if(IsClient())
if (IsClient()) {
CastToClient()->CheckIncreaseSkill(EQ::skills::SkillBackstab, other, 10);
}
m_specialattacks = eSpecialAttacks::None;
int double_bs_front = aabonuses.Double_Backstab_Front + itembonuses.Double_Backstab_Front + spellbonuses.Double_Backstab_Front;
if (double_bs_front && other->GetHP() > 0 && zone->random.Roll(double_bs_front))
if (double_bs_front && other->GetHP() > 0 && zone->random.Roll(double_bs_front)) {
RogueBackstab(other, false, ReuseTime);
}
}
else { //We do a single regular attack if we attack from the front without chaotic stab
Attack(other, EQ::invslot::slotPrimary);
@@ -790,10 +820,25 @@ void Mob::RogueBackstab(Mob* other, bool min_damage, int ReuseTime)
// make sure we can hit (bane, magical, etc)
if (IsClient()) {
const EQ::ItemInstance *wpn = CastToClient()->GetInv().GetItem(EQ::invslot::slotPrimary);
if (!GetWeaponDamage(other, wpn))
const EQ::ItemInstance* wpn = CastToClient()->GetInv().GetItem(EQ::invslot::slotPrimary);
if (!GetWeaponDamage(other, wpn)) {
return;
} else if (!GetWeaponDamage(other, (const EQ::ItemData*)nullptr)){
}
}
else if (IsBot()) {
EQ::ItemInstance* botweaponInst = CastToBot()->GetBotItem(EQ::invslot::slotPrimary);
if (botweaponInst) {
if (!GetWeaponDamage(other, botweaponInst)) {
return;
}
}
else if (!GetWeaponDamage(other, (const EQ::ItemData*)nullptr)) {
return;
}
}
else if (!GetWeaponDamage(other, (const EQ::ItemData*)nullptr)) {
return;
}
@@ -2454,7 +2499,7 @@ int Mob::TryAssassinate(Mob *defender, EQ::skills::SkillType skillInUse)
int chance = GetDEX();
if (skillInUse == EQ::skills::SkillBackstab) {
chance = 100 * chance / (chance + 3500);
if (IsClient() || IsBot()) {
if (IsOfClientBot()) {
chance += GetHeroicDEX();
}
chance *= 10;