This commit is contained in:
2025-03-20 20:21:47 -05:00
parent 04232ec50c
commit f655a11e93
3 changed files with 54 additions and 38 deletions
+23 -6
View File
@@ -101,10 +101,6 @@ public enum CombatManager {
public static void AttackTarget(PlayerCharacter playerCharacter, AbstractWorldObject target) {
if(playerCharacter != null && playerCharacter.isBoxed)
if(target.getObjectType().equals(GameObjectType.PlayerCharacter))
return;
boolean swingOffhand = false;
//check my weapon can I do an offhand attack
@@ -316,6 +312,7 @@ public enum CombatManager {
if(pet.combatTarget == null && pet.assist)
pet.setCombatTarget(attacker.combatTarget);
}
}
@@ -484,6 +481,7 @@ public enum CombatManager {
}
}
range += 2;
if (NotInRange(abstractCharacter, target, range)) {
//target is in stealth and can't be seen by source
@@ -507,6 +505,16 @@ public enum CombatManager {
}
}
if(abstractCharacter.getObjectType().equals(GameObjectType.PlayerCharacter)){
PlayerCharacter pc = (PlayerCharacter)abstractCharacter;
if(pc.isBoxed){
if(target.getObjectType().equals(GameObjectType.PlayerCharacter)) {
ChatManager.chatSystemInfo(pc, "You Are PvE Flagged: Cannot Attack Players.");
attackFailure = true;
}
}
}
//TODO Verify attacker has los (if not ranged weapon).
if (!attackFailure) {
@@ -933,6 +941,11 @@ public enum CombatManager {
float d = 0f;
int originalDamage = (int)damage;
if(ac != null && ac.getObjectType().equals(GameObjectType.PlayerCharacter)){
damage *= ((PlayerCharacter)ac).ZergMultiplier;
} // Health modifications are modified by the ZergMechanic
errorTrack = 12;
//Subtract Damage from target's health
@@ -949,9 +962,13 @@ public enum CombatManager {
ac.setHateValue(damage * MBServerStatics.PLAYER_COMBAT_HATE_MODIFIER);
((Mob) tarAc).handleDirectAggro(ac);
}
if (tarAc.getHealth() > 0)
if (tarAc.getHealth() > 0) {
d = tarAc.modifyHealth(-damage, ac, false);
if(tarAc != null && tarAc.getObjectType().equals(GameObjectType.PlayerCharacter) && ((PlayerCharacter)ac).ZergMultiplier != 1.0f){
PlayerCharacter debugged = (PlayerCharacter)tarAc;
ChatManager.chatSystemInfo(debugged, "ZERG DEBUG: " + ac.getName() + " Hits You For: " + (int)damage + " instead of " + originalDamage);
}
}
tarAc.cancelOnTakeDamage();
+17 -32
View File
@@ -1093,7 +1093,7 @@ public enum PowersManager {
continue;
// If something blocks the action, then stop
if (ab.blocked(target, pb, trains,playerCharacter)) {
if (ab.blocked(target, pb, trains, playerCharacter)) {
PowersManager.sendEffectMsg(playerCharacter, 5, ab, pb);
continue;
@@ -1280,7 +1280,7 @@ public enum PowersManager {
continue;
// If something blocks the action, then stop
if (ab.blocked(target, pb, trains,caster))
if (ab.blocked(target, pb, trains, caster))
continue;
// TODO handle overwrite stack order here
String stackType = ab.getStackType();
@@ -1481,7 +1481,7 @@ public enum PowersManager {
// Handle Accepting or Denying a summons.
// set timer based on summon type.
boolean wentThrough = false;
if (msg.accepted())
if (msg.accepted()) {
// summons accepted, let's move the player if within time
if (source.isAlive()) {
@@ -1527,14 +1527,14 @@ public enum PowersManager {
duration = 45000; // Belgosh Summons, 45 seconds
boolean enemiesNear = false;
for(AbstractWorldObject awo : WorldGrid.getObjectsInRangePartial(pc.loc,MBServerStatics.CHARACTER_LOAD_RANGE, MBServerStatics.MASK_PLAYER)){
PlayerCharacter playerCharacter = (PlayerCharacter)awo;
if(!playerCharacter.guild.getNation().equals(pc.guild.getNation())){
for (AbstractWorldObject awo : WorldGrid.getObjectsInRangePartial(pc.loc, MBServerStatics.CHARACTER_LOAD_RANGE, MBServerStatics.MASK_PLAYER)) {
PlayerCharacter playerCharacter = (PlayerCharacter) awo;
if (!playerCharacter.guild.getNation().equals(pc.guild.getNation())) {
enemiesNear = true;
}
}
if(enemiesNear && !pc.isInSafeZone())
if (enemiesNear && !pc.isInSafeZone())
duration += 60000;
// Teleport to summoners location
@@ -1545,7 +1545,10 @@ public enum PowersManager {
timers.put("Summon", jc);
wentThrough = true;
}
}else{
// recycle summons power
finishRecycleTime(428523680, source, true);
}
// Summons failed
if (!wentThrough)
// summons refused. Let's be nice and reset recycle timer
@@ -1834,6 +1837,10 @@ public enum PowersManager {
private static void applyPowerA(AbstractCharacter ac, AbstractWorldObject target,
Vector3fImmutable targetLoc, PowersBase pb, int trains,
boolean fromItem) {
if(fromItem && pb.token == 429021400)
trains = 40;
int time = pb.getCastTime(trains);
if (!fromItem)
finishApplyPowerA(ac, target, targetLoc, pb, trains, false);
@@ -1899,7 +1906,7 @@ public enum PowersManager {
if (trains < ab.getMinTrains() || trains > ab.getMaxTrains())
continue;
// If something blocks the action, then stop
if (ab.blocked(target, pb, trains,ac))
if (ab.blocked(target, pb, trains, ac))
// sendPowerMsg(pc, 5, msg);
continue;
// TODO handle overwrite stack order here
@@ -1975,31 +1982,9 @@ public enum PowersManager {
public static void runPowerAction(AbstractCharacter source, AbstractWorldObject awo, Vector3fImmutable targetLoc, ActionsBase ab, int trains, PowersBase pb) {
AbstractPowerAction pa = ab.getPowerAction();
if (pa == null) {
Logger.error(
"runPowerAction(): PowerAction not found of IDString: "
+ ab.getEffectID());
Logger.error("runPowerAction(): PowerAction not found of IDString: " + ab.getEffectID());
return;
}
if(AbstractCharacter.IsAbstractCharacter(awo)) {
try {
boolean immune = false;
AbstractCharacter absChar = (AbstractCharacter) awo;
for (AbstractEffectModifier mod : ab.getPowerAction().getEffectsBase().getModifiers()) {
if (absChar.getBonuses() != null) {
if (absChar.getBonuses().getBool(ModType.ImmuneTo, mod.sourceType) || absChar.getBonuses().getBool(ModType.NoMod, mod.sourceType))
immune = true;
}
}
if (immune)
return;
}catch(Exception e){
}
}
pa.startAction(source, awo, targetLoc, trains, ab, pb);
}