Public Repository for the Magicbane Shadowbane Emulator
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

71 lines
2.8 KiB

// • ▌ ▄ ·. ▄▄▄· ▄▄ • ▪ ▄▄· ▄▄▄▄· ▄▄▄· ▐▄▄▄ ▄▄▄ .
// ·██ ▐███▪▐█ ▀█ ▐█ ▀ ▪██ ▐█ ▌▪▐█ ▀█▪▐█ ▀█ •█▌ ▐█▐▌·
// ▐█ ▌▐▌▐█·▄█▀▀█ ▄█ ▀█▄▐█·██ ▄▄▐█▀▀█▄▄█▀▀█ ▐█▐ ▐▌▐▀▀▀
// ██ ██▌▐█▌▐█ ▪▐▌▐█▄▪▐█▐█▌▐███▌██▄▪▐█▐█ ▪▐▌██▐ █▌▐█▄▄▌
// ▀▀ █▪▀▀▀ ▀ ▀ ·▀▀▀▀ ▀▀▀·▀▀▀ ·▀▀▀▀ ▀ ▀ ▀▀ █▪ ▀▀▀
// Magicbane Emulator Project © 2013 - 2022
// www.magicbane.com
package engine.powers.poweractions;
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 engine.wpak.data.PowerAction;
public class CharmPowerAction extends AbstractPowerAction {
private int levelCap;
private int levelCapRamp;
public CharmPowerAction(PowerAction powerAction) {
super(powerAction);
this.levelCap = powerAction.levelCap;
this.levelCapRamp = powerAction.levelCurve.ordinal();
}
@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 = this.levelCap + (this.levelCapRamp * trains);
if (mob.getLevel() > cap && pb.getToken() != 1577464266)
return;
//turn mob into pet.
owner.commandSiegeMinion(mob);
}
@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
}
}