levelCapRamp is a float column (e.g. 0.65) but was read with getInt, so the Charm level cap never grew with trains. Charm caps now add ramp * trains. FearPowerAction gets the same fix; nothing builds it today. TrackPowerAction tested (flags & 1024) == 1, which is always false. No caller reads trackPlayer/trackCorpse, so that part changes nothing. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
77 lines
3.2 KiB
Java
77 lines
3.2 KiB
Java
// • ▌ ▄ ·. ▄▄▄· ▄▄ • ▪ ▄▄· ▄▄▄▄· ▄▄▄· ▐▄▄▄ ▄▄▄ .
|
|
// ·██ ▐███▪▐█ ▀█ ▐█ ▀ ▪██ ▐█ ▌▪▐█ ▀█▪▐█ ▀█ •█▌ ▐█▐▌·
|
|
// ▐█ ▌▐▌▐█·▄█▀▀█ ▄█ ▀█▄▐█·██ ▄▄▐█▀▀█▄▄█▀▀█ ▐█▐ ▐▌▐▀▀▀
|
|
// ██ ██▌▐█▌▐█ ▪▐▌▐█▄▪▐█▐█▌▐███▌██▄▪▐█▐█ ▪▐▌██▐ █▌▐█▄▄▌
|
|
// ▀▀ █▪▀▀▀ ▀ ▀ ·▀▀▀▀ ▀▀▀·▀▀▀ ·▀▀▀▀ ▀ ▀ ▀▀ █▪ ▀▀▀
|
|
// Magicbane Emulator Project © 2013 - 2026
|
|
// https://www.magicbane.com
|
|
|
|
|
|
package engine.powers.poweractions;
|
|
|
|
import engine.job.JobScheduler;
|
|
import engine.jobs.EndFearJob;
|
|
import engine.math.Vector3fImmutable;
|
|
import engine.mbEnums;
|
|
import engine.net.client.ClientConnection;
|
|
import engine.objects.AbstractCharacter;
|
|
import engine.objects.AbstractWorldObject;
|
|
import engine.objects.Mob;
|
|
import engine.objects.PlayerCharacter;
|
|
import engine.powers.ActionsBase;
|
|
import engine.powers.PowersBase;
|
|
|
|
import java.sql.ResultSet;
|
|
import java.sql.SQLException;
|
|
|
|
public class FearPowerAction extends AbstractPowerAction {
|
|
|
|
private int levelCap;
|
|
private float levelCapRamp;
|
|
|
|
public FearPowerAction(ResultSet rs) throws SQLException {
|
|
super(rs);
|
|
this.levelCap = rs.getInt("levelCap");
|
|
this.levelCapRamp = rs.getFloat("levelCapRamp");
|
|
}
|
|
|
|
@Override
|
|
protected void _startAction(AbstractCharacter source, AbstractWorldObject awo, Vector3fImmutable targetLoc, int trains, ActionsBase ab, PowersBase pb) {
|
|
if (source == null || awo == null || !(awo.getObjectType().equals(mbEnums.GameObjectType.Mob)) || !(source.getObjectType().equals(mbEnums.GameObjectType.PlayerCharacter)))
|
|
return;
|
|
|
|
PlayerCharacter owner = (PlayerCharacter) source;
|
|
ClientConnection origin = owner.getClientConnection();
|
|
if (origin == null)
|
|
return;
|
|
|
|
//verify is mob, not pet or guard
|
|
Mob mob = (Mob) awo;
|
|
if (!(mob.agentType.equals(mbEnums.AIAgentType.MOBILE)))
|
|
return;
|
|
|
|
//make sure mob isn't too high level
|
|
int cap = (int) (this.levelCap + (this.levelCapRamp * trains));
|
|
if (mob.getLevel() > cap || mob.getLevel() > 79)
|
|
return;
|
|
|
|
//Apply fear to mob
|
|
int duration = 10 + ((int) (trains * 0.5));
|
|
String stackType = ab.getStackType();
|
|
EndFearJob efj = new EndFearJob(source, awo, stackType, trains, ab, pb, null);
|
|
((Mob) awo).fearedObject = source;
|
|
JobScheduler.getInstance().scheduleJob(efj, duration * 1000);
|
|
}
|
|
|
|
@Override
|
|
protected void _handleChant(AbstractCharacter source, AbstractWorldObject target, Vector3fImmutable targetLoc, int trains, ActionsBase ab, PowersBase pb) {
|
|
}
|
|
|
|
@Override
|
|
protected void _startAction(AbstractCharacter source, AbstractWorldObject awo, Vector3fImmutable targetLoc,
|
|
int numTrains, ActionsBase ab, PowersBase pb, int duration) {
|
|
// TODO Auto-generated method stub
|
|
|
|
}
|
|
}
|