Compare commits
9 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| b944847b8a | |||
| cdf6465f60 | |||
| 3649c629b7 | |||
| 1c31070fc8 | |||
| bff41967db | |||
| d3692d0fb7 | |||
| 074a799d01 | |||
| 36ffd08a72 | |||
| 58f828b3cd |
@@ -24,3 +24,5 @@
|
|||||||
hs_err_pid*
|
hs_err_pid*
|
||||||
replay_pid*
|
replay_pid*
|
||||||
|
|
||||||
|
*.code-workspace
|
||||||
|
|
||||||
|
|||||||
@@ -1196,6 +1196,7 @@ public class Enum {
|
|||||||
Durability,
|
Durability,
|
||||||
ExclusiveDamageCap,
|
ExclusiveDamageCap,
|
||||||
Fade,
|
Fade,
|
||||||
|
Fear,
|
||||||
Fly,
|
Fly,
|
||||||
Health,
|
Health,
|
||||||
HealthFull,
|
HealthFull,
|
||||||
|
|||||||
@@ -280,6 +280,9 @@ public class dbEffectsBaseHandler extends dbHandlerBase {
|
|||||||
case Stunned:
|
case Stunned:
|
||||||
abstractEffectModifier = new StunnedEffectModifier(rs);
|
abstractEffectModifier = new StunnedEffectModifier(rs);
|
||||||
break;
|
break;
|
||||||
|
case Fear:
|
||||||
|
abstractEffectModifier = new FearEffectModifier(rs);
|
||||||
|
break;
|
||||||
case Value:
|
case Value:
|
||||||
abstractEffectModifier = new ValueEffectModifier(rs);
|
abstractEffectModifier = new ValueEffectModifier(rs);
|
||||||
if (effectBase != null) {
|
if (effectBase != null) {
|
||||||
|
|||||||
@@ -433,6 +433,11 @@ public enum CombatManager {
|
|||||||
if (bonus != null && bonus.getBool(ModType.Stunned, SourceType.None))
|
if (bonus != null && bonus.getBool(ModType.Stunned, SourceType.None))
|
||||||
attackFailure = true;
|
attackFailure = true;
|
||||||
|
|
||||||
|
//see if attacker is feared. If so, stop here
|
||||||
|
|
||||||
|
if (bonus != null && bonus.getBool(ModType.Fear, SourceType.None))
|
||||||
|
attackFailure = true;
|
||||||
|
|
||||||
//Get Range of weapon
|
//Get Range of weapon
|
||||||
|
|
||||||
float range;
|
float range;
|
||||||
|
|||||||
@@ -79,6 +79,11 @@ public enum MovementManager {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Will this prevent movement at all or only player input for movement?
|
||||||
|
if (toMove.getBonuses().getBool(ModType.Fear, SourceType.None)) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
if (msg.getEndLat() > MBServerStatics.MAX_WORLD_WIDTH)
|
if (msg.getEndLat() > MBServerStatics.MAX_WORLD_WIDTH)
|
||||||
msg.setEndLat((float) MBServerStatics.MAX_WORLD_WIDTH);
|
msg.setEndLat((float) MBServerStatics.MAX_WORLD_WIDTH);
|
||||||
|
|
||||||
@@ -408,6 +413,10 @@ public enum MovementManager {
|
|||||||
if (bonus.getBool(ModType.Stunned, SourceType.None) || bonus.getBool(ModType.CannotMove, SourceType.None))
|
if (bonus.getBool(ModType.Stunned, SourceType.None) || bonus.getBool(ModType.CannotMove, SourceType.None))
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
|
//don't move if player is feared
|
||||||
|
if (bonus.getBool(ModType.Fear, SourceType.None))
|
||||||
|
continue;
|
||||||
|
|
||||||
member.update();
|
member.update();
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -313,6 +313,9 @@ public enum PowersManager {
|
|||||||
if (bonus != null && (bonus.getBool(ModType.Stunned, SourceType.None) || bonus.getBool(ModType.CannotCast, SourceType.None) || bonus.getBool(ModType.BlockedPowerType, sourceType)))
|
if (bonus != null && (bonus.getBool(ModType.Stunned, SourceType.None) || bonus.getBool(ModType.CannotCast, SourceType.None) || bonus.getBool(ModType.BlockedPowerType, sourceType)))
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
|
if (bonus != null && bonus.getBool(ModType.Fear, SourceType.None))
|
||||||
|
return true;
|
||||||
|
|
||||||
// if moving make sure spell valid for movement
|
// if moving make sure spell valid for movement
|
||||||
Vector3fImmutable endLoc = playerCharacter.getEndLoc();
|
Vector3fImmutable endLoc = playerCharacter.getEndLoc();
|
||||||
|
|
||||||
@@ -596,6 +599,9 @@ public enum PowersManager {
|
|||||||
if (bonus != null && (bonus.getBool(ModType.Stunned, SourceType.None) || bonus.getBool(ModType.CannotCast, SourceType.None) || bonus.getBool(ModType.BlockedPowerType, sourceType)))
|
if (bonus != null && (bonus.getBool(ModType.Stunned, SourceType.None) || bonus.getBool(ModType.CannotCast, SourceType.None) || bonus.getBool(ModType.BlockedPowerType, sourceType)))
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
|
if (bonus != null && bonus.getBool(ModType.Fear, SourceType.None))
|
||||||
|
return true;
|
||||||
|
|
||||||
// if moving make sure spell valid for movement
|
// if moving make sure spell valid for movement
|
||||||
// if flying, make sure spell valid for flying.
|
// if flying, make sure spell valid for flying.
|
||||||
// if (pc.getAltitude() > 0)
|
// if (pc.getAltitude() > 0)
|
||||||
@@ -761,6 +767,11 @@ public enum PowersManager {
|
|||||||
finishRecycleTime(msg.getPowerUsedID(), playerCharacter, true);
|
finishRecycleTime(msg.getPowerUsedID(), playerCharacter, true);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (bonus.getBool(ModType.Fear, SourceType.None)) {
|
||||||
|
finishRecycleTime(msg.getPowerUsedID(), playerCharacter, true);
|
||||||
|
return;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// get target loc
|
// get target loc
|
||||||
@@ -1042,6 +1053,9 @@ public enum PowersManager {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (bonus != null && bonus.getBool(ModType.Fear, SourceType.None))
|
||||||
|
return;
|
||||||
|
|
||||||
msg.setNumTrains(9999);
|
msg.setNumTrains(9999);
|
||||||
msg.setUnknown04(2);
|
msg.setUnknown04(2);
|
||||||
DispatchMessage.sendToAllInRange(caster, msg);
|
DispatchMessage.sendToAllInRange(caster, msg);
|
||||||
@@ -2565,6 +2579,10 @@ public enum PowersManager {
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static void cancelOnFear(AbstractCharacter ac) {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
private static PowersBase getLastPower(AbstractCharacter ac) {
|
private static PowersBase getLastPower(AbstractCharacter ac) {
|
||||||
if (ac == null)
|
if (ac == null)
|
||||||
return null;
|
return null;
|
||||||
|
|||||||
@@ -0,0 +1,42 @@
|
|||||||
|
package engine.jobs;
|
||||||
|
|
||||||
|
import engine.job.AbstractJob;
|
||||||
|
import engine.objects.AbstractCharacter;
|
||||||
|
import engine.math.Vector3fImmutable;
|
||||||
|
import engine.server.MBServerStatics;
|
||||||
|
|
||||||
|
import java.util.Random;
|
||||||
|
|
||||||
|
public class FearWanderJob extends AbstractJob {
|
||||||
|
private final AbstractCharacter target;
|
||||||
|
private final Random rand = new Random();
|
||||||
|
|
||||||
|
public FearWanderJob(AbstractCharacter target) {
|
||||||
|
super();
|
||||||
|
this.target = target;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void doJob() {
|
||||||
|
// Only wander if still feared
|
||||||
|
if (target == null || !target.getBonuses().getBool(engine.Enum.ModType.Fear, engine.Enum.SourceType.None))
|
||||||
|
return;
|
||||||
|
|
||||||
|
// Pick a random direction and distance
|
||||||
|
float angle = rand.nextFloat() * (float)Math.PI * 2f;
|
||||||
|
float distance = 5f + rand.nextFloat() * 10f; // 5-15 units
|
||||||
|
|
||||||
|
Vector3fImmutable current = target.getLoc();
|
||||||
|
float newX = current.x + (float)Math.cos(angle) * distance;
|
||||||
|
float newZ = current.z + (float)Math.sin(angle) * distance;
|
||||||
|
|
||||||
|
// Clamp to world bounds if needed
|
||||||
|
newX = (float) Math.max(0, Math.min(newX, MBServerStatics.MAX_WORLD_WIDTH));
|
||||||
|
newZ = (float) Math.max(0, Math.min(newZ, MBServerStatics.MAX_WORLD_HEIGHT));
|
||||||
|
|
||||||
|
Vector3fImmutable dest = new Vector3fImmutable(newX, current.y, newZ);
|
||||||
|
|
||||||
|
// Issue movement (implement setEndLoc or similar in your AbstractCharacter)
|
||||||
|
target.setEndLoc(dest);
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -693,6 +693,8 @@ public class MobAI {
|
|||||||
DefaultLogic(mob);
|
DefaultLogic(mob);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
if(mob.isAlive())
|
||||||
|
RecoverHealth(mob);
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
Logger.info(mob.getObjectUUID() + " " + mob.getName() + " Failed At: DetermineAction" + " " + e.getMessage());
|
Logger.info(mob.getObjectUUID() + " " + mob.getName() + " Failed At: DetermineAction" + " " + e.getMessage());
|
||||||
}
|
}
|
||||||
@@ -808,7 +810,7 @@ public class MobAI {
|
|||||||
chaseTarget(mob);
|
chaseTarget(mob);
|
||||||
break;
|
break;
|
||||||
case GuardMinion:
|
case GuardMinion:
|
||||||
if (!mob.npcOwner.isAlive() || ((Mob) mob.npcOwner).despawned)
|
if (!mob.npcOwner.isAlive() && mob.getCombatTarget() == null)
|
||||||
randomGuardPatrolPoint(mob);
|
randomGuardPatrolPoint(mob);
|
||||||
else {
|
else {
|
||||||
if (mob.getCombatTarget() != null) {
|
if (mob.getCombatTarget() != null) {
|
||||||
@@ -827,6 +829,7 @@ public class MobAI {
|
|||||||
chaseTarget(mob);
|
chaseTarget(mob);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
}
|
}
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
Logger.info(mob.getObjectUUID() + " " + mob.getName() + " Failed At: CheckMobMovement" + " " + e.getMessage());
|
Logger.info(mob.getObjectUUID() + " " + mob.getName() + " Failed At: CheckMobMovement" + " " + e.getMessage());
|
||||||
@@ -1043,7 +1046,6 @@ public class MobAI {
|
|||||||
mob.setCombatTarget(newTarget);
|
mob.setCombatTarget(newTarget);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
CheckMobMovement(mob);
|
CheckMobMovement(mob);
|
||||||
CheckForAttack(mob);
|
CheckForAttack(mob);
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
@@ -1054,24 +1056,9 @@ public class MobAI {
|
|||||||
public static void GuardMinionLogic(Mob mob) {
|
public static void GuardMinionLogic(Mob mob) {
|
||||||
|
|
||||||
try {
|
try {
|
||||||
if (!mob.npcOwner.isAlive()) {
|
boolean isComanded = mob.npcOwner.isAlive();
|
||||||
|
if (!isComanded) {
|
||||||
if (mob.getCombatTarget() == null) {
|
GuardCaptainLogic(mob);
|
||||||
CheckForPlayerGuardAggro(mob);
|
|
||||||
} else {
|
|
||||||
|
|
||||||
AbstractWorldObject newTarget = ChangeTargetFromHateValue(mob);
|
|
||||||
|
|
||||||
if (newTarget != null) {
|
|
||||||
|
|
||||||
if (newTarget.getObjectType().equals(Enum.GameObjectType.PlayerCharacter)) {
|
|
||||||
if (GuardCanAggro(mob, (PlayerCharacter) newTarget))
|
|
||||||
mob.setCombatTarget(newTarget);
|
|
||||||
} else
|
|
||||||
mob.setCombatTarget(newTarget);
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}else {
|
}else {
|
||||||
if (mob.npcOwner.getCombatTarget() != null)
|
if (mob.npcOwner.getCombatTarget() != null)
|
||||||
mob.setCombatTarget(mob.npcOwner.getCombatTarget());
|
mob.setCombatTarget(mob.npcOwner.getCombatTarget());
|
||||||
@@ -1110,22 +1097,6 @@ public class MobAI {
|
|||||||
CheckMobMovement(mob);
|
CheckMobMovement(mob);
|
||||||
|
|
||||||
CheckForAttack(mob);
|
CheckForAttack(mob);
|
||||||
|
|
||||||
//recover health
|
|
||||||
|
|
||||||
if (mob.getTimestamps().containsKey("HEALTHRECOVERED") == false)
|
|
||||||
mob.getTimestamps().put("HEALTHRECOVERED", System.currentTimeMillis());
|
|
||||||
|
|
||||||
if (mob.isSit() && mob.getTimeStamp("HEALTHRECOVERED") < System.currentTimeMillis() + 3000)
|
|
||||||
if (mob.getHealth() < mob.getHealthMax()) {
|
|
||||||
|
|
||||||
float recoveredHealth = mob.getHealthMax() * ((1 + mob.getBonuses().getFloatPercentAll(Enum.ModType.HealthRecoverRate, Enum.SourceType.None)) * 0.01f);
|
|
||||||
mob.setHealth(mob.getHealth() + recoveredHealth);
|
|
||||||
mob.getTimestamps().put("HEALTHRECOVERED", System.currentTimeMillis());
|
|
||||||
|
|
||||||
if (mob.getHealth() > mob.getHealthMax())
|
|
||||||
mob.setHealth(mob.getHealthMax());
|
|
||||||
}
|
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
Logger.info(mob.getObjectUUID() + " " + mob.getName() + " Failed At: PetLogic" + " " + e.getMessage());
|
Logger.info(mob.getObjectUUID() + " " + mob.getName() + " Failed At: PetLogic" + " " + e.getMessage());
|
||||||
}
|
}
|
||||||
@@ -1379,4 +1350,22 @@ public class MobAI {
|
|||||||
}
|
}
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static void RecoverHealth(Mob mob){
|
||||||
|
//recover health
|
||||||
|
|
||||||
|
if (mob.getTimestamps().containsKey("HEALTHRECOVERED") == false)
|
||||||
|
mob.getTimestamps().put("HEALTHRECOVERED", System.currentTimeMillis());
|
||||||
|
|
||||||
|
if (mob.isSit() && mob.getTimeStamp("HEALTHRECOVERED") < System.currentTimeMillis() + 3000)
|
||||||
|
if (mob.getHealth() < mob.getHealthMax()) {
|
||||||
|
|
||||||
|
float recoveredHealth = mob.getHealthMax() * ((1 + mob.getBonuses().getFloatPercentAll(Enum.ModType.HealthRecoverRate, Enum.SourceType.None)) * 0.01f);
|
||||||
|
mob.setHealth(mob.getHealth() + recoveredHealth);
|
||||||
|
mob.getTimestamps().put("HEALTHRECOVERED", System.currentTimeMillis());
|
||||||
|
|
||||||
|
if (mob.getHealth() > mob.getHealthMax())
|
||||||
|
mob.setHealth(mob.getHealthMax());
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
@@ -124,7 +124,7 @@ public class CombatUtilities {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public static boolean canSwing(Mob agent) {
|
public static boolean canSwing(Mob agent) {
|
||||||
return (agent.isAlive() && !agent.getBonuses().getBool(ModType.Stunned, SourceType.None));
|
return (agent.isAlive() && !agent.getBonuses().getBool(ModType.Stunned, SourceType.None) && !agent.getBonuses().getBool(ModType.Fear, SourceType.None));
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void swingIsMiss(Mob agent, AbstractWorldObject target, int animation) {
|
public static void swingIsMiss(Mob agent, AbstractWorldObject target, int animation) {
|
||||||
|
|||||||
@@ -169,7 +169,7 @@ public class MovementUtilities {
|
|||||||
if (agent.getMobBase() != null && Enum.MobFlagType.SENTINEL.elementOf(agent.getMobBase().getFlags()))
|
if (agent.getMobBase() != null && Enum.MobFlagType.SENTINEL.elementOf(agent.getMobBase().getFlags()))
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
return (agent.isAlive() && !agent.getBonuses().getBool(ModType.Stunned, SourceType.None) && !agent.getBonuses().getBool(ModType.CannotMove, SourceType.None));
|
return (agent.isAlive() && !agent.getBonuses().getBool(ModType.Stunned, SourceType.None) && !agent.getBonuses().getBool(ModType.Fear, SourceType.None) && !agent.getBonuses().getBool(ModType.CannotMove, SourceType.None));
|
||||||
}
|
}
|
||||||
|
|
||||||
public static Vector3fImmutable randomPatrolLocation(Mob agent, Vector3fImmutable center, float radius) {
|
public static Vector3fImmutable randomPatrolLocation(Mob agent, Vector3fImmutable center, float radius) {
|
||||||
|
|||||||
@@ -1653,6 +1653,30 @@ public abstract class AbstractCharacter extends AbstractWorldObject {
|
|||||||
PowersManager.cancelOnStun(this);
|
PowersManager.cancelOnStun(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public final void cancelOnFear() {
|
||||||
|
boolean changed = false;
|
||||||
|
for (String s : this.effects.keySet()) {
|
||||||
|
Effect eff = this.effects.get(s);
|
||||||
|
if (eff == null)
|
||||||
|
continue;
|
||||||
|
if (eff.cancelOnFear() && eff.cancel()) {
|
||||||
|
eff.cancelJob();
|
||||||
|
this.effects.remove(s);
|
||||||
|
changed = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
JobContainer wanderJob = this.getTimers().get("FearWander");
|
||||||
|
if (wanderJob != null) {
|
||||||
|
wanderJob.cancelJob();
|
||||||
|
this.getTimers().remove("FearWander");
|
||||||
|
}
|
||||||
|
if (changed) {
|
||||||
|
applyBonuses();
|
||||||
|
}
|
||||||
|
PowersManager.cancelOnFear(this);
|
||||||
|
}
|
||||||
|
|
||||||
//Call to apply any new effects to player
|
//Call to apply any new effects to player
|
||||||
public synchronized void applyBonuses() {
|
public synchronized void applyBonuses() {
|
||||||
PlayerCharacter player;
|
PlayerCharacter player;
|
||||||
|
|||||||
@@ -48,6 +48,7 @@ public class Effect {
|
|||||||
private boolean cancelOnTerritoryClaim;
|
private boolean cancelOnTerritoryClaim;
|
||||||
private boolean cancelOnUnEquip;
|
private boolean cancelOnUnEquip;
|
||||||
private boolean cancelOnStun;
|
private boolean cancelOnStun;
|
||||||
|
private boolean cancelOnFear;
|
||||||
private boolean bakedInStat = false;
|
private boolean bakedInStat = false;
|
||||||
private boolean isStatic = false;
|
private boolean isStatic = false;
|
||||||
private int effectSourceType = 0;
|
private int effectSourceType = 0;
|
||||||
@@ -80,6 +81,7 @@ public class Effect {
|
|||||||
this.cancelOnTerritoryClaim = false;
|
this.cancelOnTerritoryClaim = false;
|
||||||
this.cancelOnUnEquip = false;
|
this.cancelOnUnEquip = false;
|
||||||
this.cancelOnStun = false;
|
this.cancelOnStun = false;
|
||||||
|
this.cancelOnFear = false;
|
||||||
this.eb = eb;
|
this.eb = eb;
|
||||||
this.trains = trains;
|
this.trains = trains;
|
||||||
}
|
}
|
||||||
@@ -99,6 +101,7 @@ public class Effect {
|
|||||||
this.cancelOnTerritoryClaim = false;
|
this.cancelOnTerritoryClaim = false;
|
||||||
this.cancelOnUnEquip = false;
|
this.cancelOnUnEquip = false;
|
||||||
this.cancelOnStun = false;
|
this.cancelOnStun = false;
|
||||||
|
this.cancelOnFear = false;
|
||||||
this.eb = eb;
|
this.eb = eb;
|
||||||
this.trains = trains;
|
this.trains = trains;
|
||||||
this.isStatic = isStatic;
|
this.isStatic = isStatic;
|
||||||
@@ -581,6 +584,12 @@ public class Effect {
|
|||||||
return this.cancelOnStun;
|
return this.cancelOnStun;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public boolean cancelOnFear() {
|
||||||
|
if (this.eb == null)
|
||||||
|
return true;
|
||||||
|
return this.cancelOnFear;
|
||||||
|
}
|
||||||
|
|
||||||
public boolean cancelOnTakeDamage() {
|
public boolean cancelOnTakeDamage() {
|
||||||
if (this.eb == null)
|
if (this.eb == null)
|
||||||
return true;
|
return true;
|
||||||
|
|||||||
@@ -1249,7 +1249,7 @@ public class Mob extends AbstractIntelligenceAgent {
|
|||||||
if (!this.isMoving())
|
if (!this.isMoving())
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if (this.isAlive() == false || this.getBonuses().getBool(ModType.Stunned, SourceType.None) || this.getBonuses().getBool(ModType.CannotMove, SourceType.None)) {
|
if (this.isAlive() == false || this.getBonuses().getBool(ModType.Stunned, SourceType.None) || this.getBonuses().getBool(ModType.Fear, SourceType.None) || this.getBonuses().getBool(ModType.CannotMove, SourceType.None)) {
|
||||||
//Target is stunned or rooted. Don't move
|
//Target is stunned or rooted. Don't move
|
||||||
|
|
||||||
this.stopMovement(this.getMovementLoc());
|
this.stopMovement(this.getMovementLoc());
|
||||||
|
|||||||
@@ -4407,6 +4407,10 @@ public class PlayerCharacter extends AbstractCharacter {
|
|||||||
if (this.bonuses.getBool(ModType.Stunned, SourceType.None))
|
if (this.bonuses.getBool(ModType.Stunned, SourceType.None))
|
||||||
return 0f;
|
return 0f;
|
||||||
|
|
||||||
|
if (this.bonuses.getBool(
|
||||||
|
ModType.Fear, SourceType.None))
|
||||||
|
return 0f;
|
||||||
|
|
||||||
// Get base skill amount
|
// Get base skill amount
|
||||||
CharacterSkill sk = this.skills.get(type);
|
CharacterSkill sk = this.skills.get(type);
|
||||||
float amount;
|
float amount;
|
||||||
@@ -4437,6 +4441,10 @@ public class PlayerCharacter extends AbstractCharacter {
|
|||||||
if (this.bonuses.getBool(ModType.Stunned, SourceType.None))
|
if (this.bonuses.getBool(ModType.Stunned, SourceType.None))
|
||||||
return 0f;
|
return 0f;
|
||||||
|
|
||||||
|
if (this.bonuses.getBool(ModType.Fear, SourceType.None))
|
||||||
|
return 0f;
|
||||||
|
|
||||||
|
|
||||||
// Get base skill amount
|
// Get base skill amount
|
||||||
CharacterSkill sk = this.skills.get(sourceType.name());
|
CharacterSkill sk = this.skills.get(sourceType.name());
|
||||||
float amount;
|
float amount;
|
||||||
@@ -4897,6 +4905,12 @@ public class PlayerCharacter extends AbstractCharacter {
|
|||||||
this.region = AbstractWorldObject.GetRegionByWorldObject(this);
|
this.region = AbstractWorldObject.GetRegionByWorldObject(this);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
if (this.isAlive() == false || this.getBonuses().getBool(ModType.Fear, SourceType.None)) {
|
||||||
|
//Target is feared. Don't move
|
||||||
|
this.stopMovement(newLoc);
|
||||||
|
this.region = AbstractWorldObject.GetRegionByWorldObject(this);
|
||||||
|
return;
|
||||||
|
}
|
||||||
if (newLoc.equals(this.getEndLoc())) {
|
if (newLoc.equals(this.getEndLoc())) {
|
||||||
this.stopMovement(newLoc);
|
this.stopMovement(newLoc);
|
||||||
this.region = AbstractWorldObject.GetRegionByWorldObject(this);
|
this.region = AbstractWorldObject.GetRegionByWorldObject(this);
|
||||||
|
|||||||
@@ -247,6 +247,8 @@ public class ActionsBase {
|
|||||||
//TODO make this more efficient then testing strings
|
//TODO make this more efficient then testing strings
|
||||||
if (this.stackType.equals("Stun") && bonus.getBool(ModType.ImmuneTo, SourceType.Stun))
|
if (this.stackType.equals("Stun") && bonus.getBool(ModType.ImmuneTo, SourceType.Stun))
|
||||||
return true; //Currently stun immune. Skip stun
|
return true; //Currently stun immune. Skip stun
|
||||||
|
else if (this.stackType.equals("Fear") && bonus.getBool(ModType.ImmuneTo, SourceType.Fear))
|
||||||
|
return true; //Currently fear immune. Skip fear
|
||||||
else if (this.stackType.equals("Snare") && bonus.getBool(ModType.ImmuneTo, SourceType.Snare))
|
else if (this.stackType.equals("Snare") && bonus.getBool(ModType.ImmuneTo, SourceType.Snare))
|
||||||
return true; //Currently snare immune. Skip snare
|
return true; //Currently snare immune. Skip snare
|
||||||
else if (this.stackType.equals("Blindness") && bonus.getBool(ModType.ImmuneTo, SourceType.Blind))
|
else if (this.stackType.equals("Blindness") && bonus.getBool(ModType.ImmuneTo, SourceType.Blind))
|
||||||
|
|||||||
@@ -0,0 +1,58 @@
|
|||||||
|
// • ▌ ▄ ·. ▄▄▄· ▄▄ • ▪ ▄▄· ▄▄▄▄· ▄▄▄· ▐▄▄▄ ▄▄▄ .
|
||||||
|
// ·██ ▐███▪▐█ ▀█ ▐█ ▀ ▪██ ▐█ ▌▪▐█ ▀█▪▐█ ▀█ •█▌ ▐█▐▌·
|
||||||
|
// ▐█ ▌▐▌▐█·▄█▀▀█ ▄█ ▀█▄▐█·██ ▄▄▐█▀▀█▄▄█▀▀█ ▐█▐ ▐▌▐▀▀▀
|
||||||
|
// ██ ██▌▐█▌▐█ ▪▐▌▐█▄▪▐█▐█▌▐███▌██▄▪▐█▐█ ▪▐▌██▐ █▌▐█▄▄▌
|
||||||
|
// ▀▀ █▪▀▀▀ ▀ ▀ ·▀▀▀▀ ▀▀▀·▀▀▀ ·▀▀▀▀ ▀ ▀ ▀▀ █▪ ▀▀▀
|
||||||
|
// Magicbane Emulator Project © 2013 - 2022
|
||||||
|
// www.magicbane.com
|
||||||
|
|
||||||
|
|
||||||
|
package engine.powers.effectmodifiers;
|
||||||
|
|
||||||
|
import engine.Enum.GameObjectType;
|
||||||
|
import engine.Enum.ModType;
|
||||||
|
import engine.Enum.SourceType;
|
||||||
|
import engine.jobs.FearWanderJob;
|
||||||
|
import engine.job.JobContainer;
|
||||||
|
import engine.job.JobScheduler;
|
||||||
|
import engine.jobs.AbstractEffectJob;
|
||||||
|
import engine.objects.*;
|
||||||
|
|
||||||
|
import java.sql.ResultSet;
|
||||||
|
import java.sql.SQLException;
|
||||||
|
|
||||||
|
public class FearEffectModifier extends AbstractEffectModifier {
|
||||||
|
|
||||||
|
public FearEffectModifier(ResultSet rs) throws SQLException {
|
||||||
|
super(rs);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void _applyEffectModifier(AbstractCharacter source, AbstractWorldObject awo, int trains, AbstractEffectJob effect) {
|
||||||
|
// Optional: custom logic when fear is applied
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void applyBonus(AbstractCharacter ac, int trains) {
|
||||||
|
PlayerBonuses bonus = ac.getBonuses();
|
||||||
|
|
||||||
|
bonus.setBool(this.modType, this.sourceType, true);
|
||||||
|
ac.cancelOnFear();
|
||||||
|
ac.setIsCasting(false);
|
||||||
|
ac.stopMovement(ac.getLoc());
|
||||||
|
|
||||||
|
// Schedule the wander job if not already scheduled
|
||||||
|
if (ac.getTimers().get("FearWander") == null) {
|
||||||
|
JobContainer wanderJob = JobScheduler.getInstance().scheduleJob(
|
||||||
|
new FearWanderJob(ac), 2000
|
||||||
|
);
|
||||||
|
|
||||||
|
ac.getTimers().put("FearWander", wanderJob);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void applyBonus(Item item, int trains) {}
|
||||||
|
@Override
|
||||||
|
public void applyBonus(Building building, int trains) {}
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user