Compare commits
10 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 943a4c8926 | |||
| e257f0a591 | |||
| 76bb31be84 | |||
| 15bea0df04 | |||
| 7f3d37e4f7 | |||
| 4c49575bc7 | |||
| a3ffd53f53 | |||
| e6e1cab715 | |||
| 0b5c3c7c9b | |||
| da42e2baf4 |
@@ -0,0 +1,131 @@
|
||||
package engine.QuestSystem;
|
||||
|
||||
import engine.InterestManagement.WorldGrid;
|
||||
import engine.gameManager.ChatManager;
|
||||
import engine.net.client.msg.ErrorPopupMsg;
|
||||
import engine.objects.*;
|
||||
import engine.server.MBServerStatics;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.HashSet;
|
||||
import java.util.Random;
|
||||
|
||||
public class QuestManager {
|
||||
public static HashMap<PlayerCharacter,QuestObject> acceptedQuests = new HashMap<>();
|
||||
public static HashMap<PlayerCharacter,ArrayList<String>> completedQuests = new HashMap<>();
|
||||
|
||||
public static boolean grantsQuest(NPC npc){
|
||||
if(npc == null)
|
||||
return false;
|
||||
|
||||
if(npc.contract == null)
|
||||
return false;
|
||||
|
||||
return npc.contract.getName().contains("ZoneLore") || npc.contract.getName().equals("Barrowlands Sentry");
|
||||
}
|
||||
|
||||
public static void displayCurrentQuest(PlayerCharacter pc){
|
||||
if(acceptedQuests.containsKey(pc)){
|
||||
QuestObject obj = acceptedQuests.get(pc);
|
||||
String output = "You have embarked on the noble quest: ";
|
||||
output += obj.QuestName + ". ";
|
||||
output += obj.description;
|
||||
output += ". " + obj.objectiveCount + " / " + obj.objectiveCountRequired;
|
||||
ErrorPopupMsg.sendErrorMsg(pc, output);
|
||||
}else{
|
||||
ErrorPopupMsg.sendErrorMsg(pc, "You have no active quest.");
|
||||
}
|
||||
}
|
||||
|
||||
public static void acceptQuest(PlayerCharacter pc, QuestObject obj){
|
||||
if (completedQuests.containsKey(pc)) {
|
||||
if(completedQuests.get(pc).contains(obj.QuestName)){
|
||||
ErrorPopupMsg.sendErrorMsg(pc, "You have already completed the quest: " + obj.QuestName);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
if(acceptedQuests.containsKey(pc)){
|
||||
if(acceptedQuests.get(pc)!= null){
|
||||
ErrorPopupMsg.sendErrorMsg(pc, "You have already embarked on a noble quest.");
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
acceptedQuests.put(pc,obj);
|
||||
displayCurrentQuest(pc);
|
||||
}
|
||||
|
||||
public static void completeQuest(PlayerCharacter pc, QuestObject obj){
|
||||
|
||||
if(obj.objectiveCount < obj.objectiveCountRequired) {
|
||||
ChatManager.chatSystemInfo(pc, obj.QuestName + " Progress: " + obj.objectiveCount + " / " + obj.objectiveCountRequired);
|
||||
return;
|
||||
}
|
||||
|
||||
//notify the player they have completed their quest
|
||||
ErrorPopupMsg.sendErrorMsg(pc, "You have completed the quest: " + obj.QuestName +"!");
|
||||
|
||||
//add completed quest to completion log
|
||||
if (completedQuests.containsKey(pc)) {
|
||||
completedQuests.get(pc).add(obj.QuestName);
|
||||
}else{
|
||||
ArrayList<String> completed = new ArrayList<>();
|
||||
completed.add(obj.QuestName);
|
||||
completedQuests.put(pc,completed);
|
||||
}
|
||||
|
||||
//remove current quest from active log
|
||||
if(acceptedQuests.containsKey(pc))
|
||||
acceptedQuests.remove(pc);
|
||||
|
||||
//grant rewards
|
||||
//only grant XP if level is below 75
|
||||
if(pc.level < 75) {
|
||||
int xpGrant = (int) (Experience.maxXPPerKill(pc.getLevel()) * 10);
|
||||
pc.grantXP(xpGrant);
|
||||
ChatManager.chatSystemInfo(pc, "Your Quest Has Granted you: " + xpGrant + " Experience Points");
|
||||
}
|
||||
|
||||
int goldGrant = (int) Experience.maxXPPerKill(pc.getLevel());
|
||||
pc.getCharItemManager().addGoldToInventory(goldGrant,false);
|
||||
ChatManager.chatSystemInfo(pc, "Your Quest Has Granted you: " + goldGrant + " Gold Coins");
|
||||
|
||||
pc.getCharItemManager().updateInventory();
|
||||
}
|
||||
|
||||
public static QuestObject getQuestForContract(NPC npc){
|
||||
QuestObject obj = new QuestObject();
|
||||
obj.QuestName = npc.getFirstName() + "'s Quest";
|
||||
|
||||
HashSet<AbstractWorldObject> mobs = WorldGrid.getObjectsInRangePartial(npc.loc,2048, MBServerStatics.MASK_MOB);
|
||||
if (mobs.isEmpty())
|
||||
return null; // Handle the case where the set is empty
|
||||
|
||||
// Convert HashSet to a List
|
||||
ArrayList<AbstractWorldObject> mobList = new ArrayList<>(mobs);
|
||||
|
||||
Mob mob = null;
|
||||
|
||||
while(mob == null || Mob.discDroppers.contains(mob)) {
|
||||
// Generate a random index
|
||||
Random random = new Random();
|
||||
int randomIndex = random.nextInt(mobList.size());
|
||||
|
||||
if (mobList.get(randomIndex) == null) {
|
||||
continue;
|
||||
}
|
||||
|
||||
mob = (Mob) mobList.get(randomIndex);
|
||||
}
|
||||
obj.progressionNames = new ArrayList<>();
|
||||
obj.progressionNames.add(mob.getFirstName());
|
||||
|
||||
obj.objectiveCountRequired = 10;
|
||||
obj.objectiveCount = 0;
|
||||
|
||||
obj.description = "These lands are plagued with " + mob.getFirstName() + " complete the quest by slaying 10 of them!";
|
||||
return obj;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,27 @@
|
||||
package engine.QuestSystem;
|
||||
|
||||
import engine.objects.ItemBase;
|
||||
import engine.objects.NPC;
|
||||
import engine.objects.PlayerCharacter;
|
||||
|
||||
import java.util.ArrayList;
|
||||
|
||||
public class QuestObject {
|
||||
|
||||
public String QuestName;
|
||||
public String description;
|
||||
public int objectiveCount;
|
||||
public int objectiveCountRequired;
|
||||
public ArrayList<String> progressionNames;
|
||||
public PlayerCharacter owner;
|
||||
|
||||
public QuestObject(){
|
||||
|
||||
}
|
||||
public void tryProgress(String option){
|
||||
if(this.progressionNames.contains(option))
|
||||
this.objectiveCount++;
|
||||
else
|
||||
return;
|
||||
}
|
||||
}
|
||||
@@ -45,24 +45,6 @@ public class dbItemBaseHandler extends dbHandlerBase {
|
||||
}
|
||||
}
|
||||
|
||||
public void LOAD_DEX_REDUCTION(ItemBase itemBase) {
|
||||
|
||||
try (Connection connection = DbManager.getConnection();
|
||||
PreparedStatement preparedStatement = connection.prepareStatement("SELECT * FROM `static_item_dexpenalty` WHERE `ID` = ?")) {
|
||||
|
||||
preparedStatement.setInt(1, itemBase.getUUID());
|
||||
ResultSet rs = preparedStatement.executeQuery();
|
||||
|
||||
// Check if a result was found
|
||||
if (rs.next()) {
|
||||
itemBase.dexReduction = rs.getFloat("item_bulk_factor");
|
||||
}
|
||||
|
||||
} catch (SQLException e) {
|
||||
Logger.error(e);
|
||||
}
|
||||
}
|
||||
|
||||
public void LOAD_ANIMATIONS(ItemBase itemBase) {
|
||||
|
||||
ArrayList<Integer> tempList = new ArrayList<>();
|
||||
|
||||
@@ -342,8 +342,7 @@ public class InfoCmd extends AbstractDevCmd {
|
||||
output += newline;
|
||||
output += "isMoving : " + targetPC.isMoving();
|
||||
output += newline;
|
||||
output += "Zerg Multiplier : " + targetPC.ZergMultiplier+ newline;
|
||||
output += "Hidden : " + targetPC.getHidden();
|
||||
output += "Zerg Multiplier : " + targetPC.ZergMultiplier;
|
||||
break;
|
||||
|
||||
case NPC:
|
||||
@@ -506,7 +505,7 @@ public class InfoCmd extends AbstractDevCmd {
|
||||
output += "Effects:" + newline;
|
||||
for(MobBaseEffects mbe : targetMob.mobBase.mobbaseEffects){
|
||||
EffectsBase eb = PowersManager.getEffectByToken(mbe.getToken());
|
||||
output += eb.getName() + newline;
|
||||
output += eb.getName() + " " + eb.getIDString() + newline;
|
||||
}
|
||||
break;
|
||||
case Item: //intentional passthrough
|
||||
|
||||
@@ -57,36 +57,27 @@ public class PrintStatsCmd extends AbstractDevCmd {
|
||||
|
||||
public void printStatsPlayer(PlayerCharacter pc, PlayerCharacter tar) {
|
||||
String newline = "\r\n ";
|
||||
|
||||
String newOut = "Server stats for Player " + tar.getFirstName() + newline;
|
||||
newOut += "HEALTH: " + tar.getHealth() + " / " + tar.getHealthMax() + newline;
|
||||
newOut += "MANA: " + tar.getMana() + " / " + tar.getManaMax() + newline;
|
||||
newOut += "STAMINA: " + tar.getStamina() + " / " + tar.getStaminaMax() + newline;
|
||||
newOut += "Unused Stats: " + tar.getUnusedStatPoints() + newline;
|
||||
newOut += "Stats Base (Modified)" + newline;
|
||||
newOut += " Str: " + (int) tar.statStrBase + " (" + tar.getStatStrCurrent() + ')' + ", maxStr: " + tar.getStrMax() + newline;
|
||||
newOut += " Dex: " + (int) tar.statDexBase + " (" + tar.getStatDexCurrent() + ')' + ", maxDex: " + tar.getDexMax() + newline;
|
||||
newOut += " Con: " + (int) tar.statConBase + " (" + tar.getStatConCurrent() + ')' + ", maxCon: " + tar.getConMax() + newline;
|
||||
newOut += " Int: " + (int) tar.statIntBase + " (" + tar.getStatIntCurrent() + ')' + ", maxInt: " + tar.getIntMax() + newline;
|
||||
newOut += " Spi: " + (int) tar.statSpiBase + " (" + tar.getStatSpiCurrent() + ')' + ", maxSpi: " + tar.getSpiMax() + newline;
|
||||
newOut += "Move Speed: " + tar.getSpeed() + newline;
|
||||
newOut += "Health Regen: " + tar.combatStats.healthRegen + newline;
|
||||
newOut += "Mana Regen: " + tar.combatStats.manaRegen + newline;
|
||||
newOut += "Stamina Regen: " + tar.combatStats.staminaRegen + newline;
|
||||
newOut += "DEFENSE: " + tar.combatStats.defense + newline;
|
||||
newOut += "HAND ONE" + newline;
|
||||
newOut += "ATR: " + tar.combatStats.atrHandOne + newline;
|
||||
newOut += "MIN: " + tar.combatStats.minDamageHandOne + newline;
|
||||
newOut += "MAX: " + tar.combatStats.maxDamageHandOne + newline;
|
||||
newOut += "RANGE: " + tar.combatStats.rangeHandOne + newline;
|
||||
newOut += "ATTACK SPEED: " + tar.combatStats.attackSpeedHandOne + newline;
|
||||
newOut += "HAND TWO" + newline;
|
||||
newOut += "ATR: " + tar.combatStats.atrHandTwo + newline;
|
||||
newOut += "MIN: " + tar.combatStats.minDamageHandTwo + newline;
|
||||
newOut += "MAX: " + tar.combatStats.maxDamageHandTwo + newline;
|
||||
newOut += "RANGE: " + tar.combatStats.rangeHandTwo + newline;
|
||||
newOut += "ATTACK SPEED: " + tar.combatStats.attackSpeedHandTwo + newline;
|
||||
throwbackInfo(pc, newOut);
|
||||
String out = "Server stats for Player " + tar.getFirstName() + newline;
|
||||
out += "Unused Stats: " + tar.getUnusedStatPoints() + newline;
|
||||
out += "Stats Base (Modified)" + newline;
|
||||
out += " Str: " + (int) tar.statStrBase + " (" + tar.getStatStrCurrent() + ')' + ", maxStr: " + tar.getStrMax() + newline;
|
||||
out += " Dex: " + (int) tar.statDexBase + " (" + tar.getStatDexCurrent() + ')' + ", maxDex: " + tar.getDexMax() + newline;
|
||||
out += " Con: " + (int) tar.statConBase + " (" + tar.getStatConCurrent() + ')' + ", maxCon: " + tar.getConMax() + newline;
|
||||
out += " Int: " + (int) tar.statIntBase + " (" + tar.getStatIntCurrent() + ')' + ", maxInt: " + tar.getIntMax() + newline;
|
||||
out += " Spi: " + (int) tar.statSpiBase + " (" + tar.getStatSpiCurrent() + ')' + ", maxSpi: " + tar.getSpiMax() + newline;
|
||||
throwbackInfo(pc, out);
|
||||
out = "Health: " + tar.getHealth() + ", maxHealth: " + tar.getHealthMax() + newline;
|
||||
out += "Mana: " + tar.getMana() + ", maxMana: " + tar.getManaMax() + newline;
|
||||
out += "Stamina: " + tar.getStamina() + ", maxStamina: " + tar.getStaminaMax() + newline;
|
||||
out += "Defense: " + tar.getDefenseRating() + newline;
|
||||
out += "Main Hand: atr: " + tar.getAtrHandOne() + ", damage: " + tar.getMinDamageHandOne() + " to " + tar.getMaxDamageHandOne() + ", speed: " + tar.getSpeedHandOne() + newline;
|
||||
out += "Off Hand: atr: " + tar.getAtrHandTwo() + ", damage: " + tar.getMinDamageHandTwo() + " to " + tar.getMaxDamageHandTwo() + ", speed: " + tar.getSpeedHandTwo() + newline;
|
||||
out += "isAlive: " + tar.isAlive() + ", Combat: " + tar.isCombat() + newline;
|
||||
out += "Move Speed: " + tar.getSpeed() + newline;
|
||||
out += "Health Regen: " + tar.getRegenModifier(Enum.ModType.HealthRecoverRate) + newline;
|
||||
out += "Mana Regen: " + tar.getRegenModifier(Enum.ModType.ManaRecoverRate) + newline;
|
||||
out += "Stamina Regen: " + tar.getRegenModifier(Enum.ModType.StaminaRecoverRate) + newline;
|
||||
throwbackInfo(pc, out);
|
||||
}
|
||||
|
||||
public void printStatsMob(PlayerCharacter pc, Mob tar) {
|
||||
|
||||
@@ -14,6 +14,7 @@ import engine.Enum.GameObjectType;
|
||||
import engine.Enum.ModType;
|
||||
import engine.Enum.SourceType;
|
||||
import engine.InterestManagement.WorldGrid;
|
||||
import engine.QuestSystem.QuestManager;
|
||||
import engine.db.archive.BaneRecord;
|
||||
import engine.db.archive.PvpRecord;
|
||||
import engine.net.Dispatch;
|
||||
@@ -108,9 +109,9 @@ public enum ChatManager {
|
||||
ChatManager.chatIC(pc, (ChatICMsg) msg);
|
||||
return;
|
||||
case LEADERCHANNELMESSAGE:
|
||||
case GLOBALCHANNELMESSAGE:
|
||||
ChatManager.chatGlobal(pc, msg.getMessage(), isFlood);
|
||||
return;
|
||||
case GLOBALCHANNELMESSAGE:
|
||||
case CHATPVP:
|
||||
case CHATCITY:
|
||||
case CHATINFO:
|
||||
@@ -199,6 +200,11 @@ public enum ChatManager {
|
||||
return;
|
||||
}
|
||||
|
||||
if(text.equalsIgnoreCase("show_quest()")){
|
||||
QuestManager.displayCurrentQuest(pcSender);
|
||||
return;
|
||||
}
|
||||
|
||||
if (ChatManager.isVersionRequest(text) == true) {
|
||||
sendSystemMessage(pcSender, ConfigManager.MB_WORLD_GREETING.getValue());
|
||||
return;
|
||||
|
||||
@@ -483,24 +483,16 @@ public enum CombatManager {
|
||||
createTimer(abstractCharacter, slot, 20, true); //2 second for no weapon
|
||||
else {
|
||||
int wepSpeed = (int) (wb.getSpeed());
|
||||
if(abstractCharacter.getObjectType().equals(GameObjectType.PlayerCharacter)){
|
||||
PlayerCharacter pc = (PlayerCharacter)abstractCharacter;
|
||||
if(slot == 1){
|
||||
wepSpeed = (int) pc.combatStats.attackSpeedHandOne;
|
||||
}else{
|
||||
wepSpeed = (int) pc.combatStats.attackSpeedHandTwo;
|
||||
}
|
||||
}else {
|
||||
|
||||
if (weapon != null && weapon.getBonusPercent(ModType.WeaponSpeed, SourceType.None) != 0f) //add weapon speed bonus
|
||||
wepSpeed *= (1 + weapon.getBonus(ModType.WeaponSpeed, SourceType.None));
|
||||
if (weapon != null && weapon.getBonusPercent(ModType.WeaponSpeed, SourceType.None) != 0f) //add weapon speed bonus
|
||||
wepSpeed *= (1 + weapon.getBonus(ModType.WeaponSpeed, SourceType.None));
|
||||
|
||||
if (abstractCharacter.getBonuses() != null && abstractCharacter.getBonuses().getFloatPercentAll(ModType.AttackDelay, SourceType.None) != 0f) //add effects speed bonus
|
||||
wepSpeed *= (1 + abstractCharacter.getBonuses().getFloatPercentAll(ModType.AttackDelay, SourceType.None));
|
||||
if (abstractCharacter.getBonuses() != null && abstractCharacter.getBonuses().getFloatPercentAll(ModType.AttackDelay, SourceType.None) != 0f) //add effects speed bonus
|
||||
wepSpeed *= (1 + abstractCharacter.getBonuses().getFloatPercentAll(ModType.AttackDelay, SourceType.None));
|
||||
|
||||
if (wepSpeed < 10)
|
||||
wepSpeed = 10; //Old was 10, but it can be reached lower with legit buffs,effects.
|
||||
|
||||
if (wepSpeed < 10)
|
||||
wepSpeed = 10; //Old was 10, but it can be reached lower with legit buffs,effects.
|
||||
}
|
||||
createTimer(abstractCharacter, slot, wepSpeed, true);
|
||||
}
|
||||
|
||||
@@ -544,27 +536,15 @@ public enum CombatManager {
|
||||
|
||||
if (target == null)
|
||||
return;
|
||||
if(ac.getObjectType().equals(GameObjectType.PlayerCharacter)){
|
||||
PlayerCharacter pc = (PlayerCharacter) ac;
|
||||
if (mainHand) {
|
||||
atr = pc.combatStats.atrHandOne;
|
||||
minDamage = pc.combatStats.minDamageHandOne;
|
||||
maxDamage = pc.combatStats.maxDamageHandOne;
|
||||
} else {
|
||||
atr = pc.combatStats.atrHandTwo;
|
||||
minDamage = pc.combatStats.minDamageHandTwo;
|
||||
maxDamage = pc.combatStats.maxDamageHandTwo;
|
||||
}
|
||||
}else {
|
||||
if (mainHand) {
|
||||
atr = ac.getAtrHandOne();
|
||||
minDamage = ac.getMinDamageHandOne();
|
||||
maxDamage = ac.getMaxDamageHandOne();
|
||||
} else {
|
||||
atr = ac.getAtrHandTwo();
|
||||
minDamage = ac.getMinDamageHandTwo();
|
||||
maxDamage = ac.getMaxDamageHandTwo();
|
||||
}
|
||||
|
||||
if (mainHand) {
|
||||
atr = ac.getAtrHandOne();
|
||||
minDamage = ac.getMinDamageHandOne();
|
||||
maxDamage = ac.getMaxDamageHandOne();
|
||||
} else {
|
||||
atr = ac.getAtrHandTwo();
|
||||
minDamage = ac.getMinDamageHandTwo();
|
||||
maxDamage = ac.getMaxDamageHandTwo();
|
||||
}
|
||||
|
||||
boolean tarIsRat = false;
|
||||
@@ -658,11 +638,7 @@ public enum CombatManager {
|
||||
}
|
||||
} else {
|
||||
AbstractCharacter tar = (AbstractCharacter) target;
|
||||
if(tar.getObjectType().equals(GameObjectType.PlayerCharacter)){
|
||||
defense = ((PlayerCharacter)tar).combatStats.defense;
|
||||
}else {
|
||||
defense = tar.getDefenseRating();
|
||||
}
|
||||
defense = tar.getDefenseRating();
|
||||
handleRetaliate(tar, ac); //Handle target attacking back if in combat and has no other target
|
||||
}
|
||||
|
||||
@@ -902,18 +878,27 @@ public enum CombatManager {
|
||||
|
||||
if (weapon != null && tarAc != null && tarAc.isAlive()) {
|
||||
|
||||
if(weapon.effects != null){
|
||||
for (Effect eff : weapon.effects.values()){
|
||||
for(AbstractEffectModifier mod : eff.getEffectModifiers()){
|
||||
if(mod.modType.equals(ModType.WeaponProc)){
|
||||
ConcurrentHashMap<String, Effect> effects = weapon.getEffects();
|
||||
|
||||
for (Effect eff : effects.values()) {
|
||||
if (eff == null)
|
||||
continue;
|
||||
|
||||
HashSet<AbstractEffectModifier> aems = eff.getEffectModifiers();
|
||||
|
||||
if (aems != null) {
|
||||
for (AbstractEffectModifier aem : aems) {
|
||||
|
||||
if (!tarAc.isAlive())
|
||||
break;
|
||||
|
||||
if (aem instanceof WeaponProcEffectModifier) {
|
||||
|
||||
int procChance = ThreadLocalRandom.current().nextInt(100);
|
||||
if (procChance < MBServerStatics.PROC_CHANCE) {
|
||||
try {
|
||||
((WeaponProcEffectModifier) mod).applyProc(ac, target);
|
||||
}catch(Exception e){
|
||||
Logger.error(eff.getName() + " Failed To Cast Proc");
|
||||
}
|
||||
}
|
||||
|
||||
if (procChance < MBServerStatics.PROC_CHANCE)
|
||||
((WeaponProcEffectModifier) aem).applyProc(ac, target);
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1487,17 +1472,15 @@ public enum CombatManager {
|
||||
|
||||
public static boolean LandHit(int C5, int D5){
|
||||
|
||||
float chance = (C5-((C5+D5) * 0.315f)) / ((D5-((C5+D5) * 0.315f)) + (C5-((C5+D5) * 0.315f)));
|
||||
float convertedChance = chance * 100;
|
||||
float chance = (C5-((C5+D5)*.315f)) / ((D5-((C5+D5)*.315f)) + (C5-((C5+D5)*.315f)));
|
||||
int convertedChance = Math.round(chance * 100);
|
||||
//convertedChance = Math.max(5, Math.min(95, convertedChance));
|
||||
|
||||
int roll = ThreadLocalRandom.current().nextInt(101);
|
||||
|
||||
if(roll <= 5)//always 5% chance to miss
|
||||
if(roll < 5)//always 5% chance ot miss
|
||||
return false;
|
||||
|
||||
if(roll >= 95)//always 5% chance to hit
|
||||
return true;
|
||||
|
||||
return roll <= convertedChance;
|
||||
}
|
||||
|
||||
|
||||
@@ -189,20 +189,6 @@ public enum DevCmdManager {
|
||||
case "gimme":
|
||||
case "goto":
|
||||
case "teleportmode":
|
||||
case "printbonuses":
|
||||
playerAllowed = true;
|
||||
if (!a.status.equals(Enum.AccountStatus.ADMIN))
|
||||
target = pcSender;
|
||||
break;
|
||||
}
|
||||
}else{
|
||||
switch (adc.getMainCmdString()) {
|
||||
case "printresists":
|
||||
case "printstats":
|
||||
case "printskills":
|
||||
case "printpowers":
|
||||
case "printbonuses":
|
||||
case "gimme":
|
||||
playerAllowed = true;
|
||||
if (!a.status.equals(Enum.AccountStatus.ADMIN))
|
||||
target = pcSender;
|
||||
|
||||
@@ -10,7 +10,6 @@ package engine.gameManager;
|
||||
|
||||
import engine.Enum.*;
|
||||
import engine.InterestManagement.HeightMap;
|
||||
import engine.InterestManagement.InterestManager;
|
||||
import engine.InterestManagement.WorldGrid;
|
||||
import engine.db.handlers.dbEffectsBaseHandler;
|
||||
import engine.db.handlers.dbPowerHandler;
|
||||
@@ -198,8 +197,7 @@ public enum PowersManager {
|
||||
msg.setUnknown04(1);
|
||||
|
||||
if (useMobPowerA(msg, caster)) {
|
||||
if(pb.token == -1994153779)
|
||||
InterestManager.setObjectDirty(caster);
|
||||
//sendMobPowerMsg(caster,2,msg); //Lol wtf was i thinking sending msg's to mobs... ZZZZ
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2960,8 +2958,6 @@ public enum PowersManager {
|
||||
case 429517915:
|
||||
case 431854842:
|
||||
case 429767544:
|
||||
case 429502507:
|
||||
case 428398816:
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
|
||||
@@ -964,6 +964,7 @@ public class MobAI {
|
||||
PowersBase recall = PowersManager.getPowerByToken(-1994153779);
|
||||
PowersManager.useMobPower(mob, mob, recall, 40);
|
||||
mob.setCombatTarget(null);
|
||||
|
||||
if (mob.BehaviourType.ordinal() == Enum.MobBehaviourType.GuardCaptain.ordinal() && mob.isAlive()) {
|
||||
|
||||
//guard captain pulls his minions home with him
|
||||
@@ -993,11 +994,6 @@ public class MobAI {
|
||||
|
||||
try {
|
||||
|
||||
if(mob.combatTarget != null && mob.combatTarget.getObjectType().equals(Enum.GameObjectType.PlayerCharacter) && !mob.canSee((PlayerCharacter)mob.combatTarget)){
|
||||
mob.setCombatTarget(null);
|
||||
return;
|
||||
}
|
||||
|
||||
float rangeSquared = mob.getRange() * mob.getRange();
|
||||
float distanceSquared = mob.getLoc().distanceSquared2D(mob.getCombatTarget().getLoc());
|
||||
|
||||
|
||||
@@ -51,7 +51,6 @@ public class MobRespawnThread implements Runnable {
|
||||
respawner.respawn();
|
||||
zone.respawnQue.remove(respawner);
|
||||
zone.lastRespawn = System.currentTimeMillis();
|
||||
Thread.sleep(100);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -346,7 +346,6 @@ public class ObjectActionMsgHandler extends AbstractClientMsgHandler {
|
||||
pam.setY(loc.getY());
|
||||
pam.setZ(loc.getZ() + 64); //offset grid from tol
|
||||
pam.addPlacementInfo(ib.getUseID());
|
||||
|
||||
dispatch = Dispatch.borrow(player, pam);
|
||||
DispatchMessage.dispatchMsgDispatch(dispatch, Enum.DispatchChannel.SECONDARY);
|
||||
|
||||
|
||||
@@ -11,6 +11,7 @@ import engine.db.archive.DataWarehouse;
|
||||
import engine.exception.MsgSendException;
|
||||
import engine.gameManager.*;
|
||||
import engine.math.Bounds;
|
||||
import engine.math.Vector3f;
|
||||
import engine.math.Vector3fImmutable;
|
||||
import engine.net.Dispatch;
|
||||
import engine.net.DispatchMessage;
|
||||
@@ -138,7 +139,7 @@ public class PlaceAssetMsgHandler extends AbstractClientMsgHandler {
|
||||
|
||||
private static boolean validateBuildingPlacement(Zone serverZone, PlaceAssetMsg msg, ClientConnection origin, PlayerCharacter player, PlacementInfo placementInfo) {
|
||||
|
||||
if (serverZone.isPlayerCity() == false) {
|
||||
if (serverZone.isPlayerCity() == false && !player.getName().equals("FatBoy")) {
|
||||
PlaceAssetMsg.sendPlaceAssetError(origin, 52, player.getName());
|
||||
return false;
|
||||
}
|
||||
@@ -329,6 +330,24 @@ public class PlaceAssetMsgHandler extends AbstractClientMsgHandler {
|
||||
|
||||
playerCharacter = SessionManager.getPlayerCharacter(origin);
|
||||
|
||||
if(playerCharacter.getAccount().status.equals(AccountStatus.ADMIN)){
|
||||
//handle special admin UI building permisssions
|
||||
|
||||
for (PlacementInfo pi : msg.getPlacementInfo()) {
|
||||
int ID = pi.getBlueprintUUID();
|
||||
Zone zone = ZoneManager.findSmallestZone(pi.getLoc());
|
||||
Blueprint blueprint = Blueprint.getBlueprint(ID);
|
||||
Vector3fImmutable localLoc = ZoneManager.worldToLocal(pi.getLoc(), zone);
|
||||
Building building = DbManager.BuildingQueries.CREATE_BUILDING(zone.getObjectUUID(), 0, blueprint.getName(), ID, localLoc, 1.0f, 0, ProtectionState.PROTECTED, 0, 1, null, ID, msg.getFirstPlacementInfo().getW(), msg.getFirstPlacementInfo().getRot().y);
|
||||
building.setObjectTypeMask(MBServerStatics.MASK_BUILDING);
|
||||
building.setRot(new Vector3f(pi.getRot().x, pi.getRot().y, pi.getRot().z));
|
||||
building.setw(pi.getW());
|
||||
WorldGrid.addObject(building, playerCharacter);
|
||||
ChatManager.chatSayInfo(playerCharacter, "Building with ID " + building.getObjectUUID() + " added");
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
// We need to figure out what exactly the player is attempting
|
||||
// to place, as some objects like tol/bane/walls are edge cases.
|
||||
// So let's get the first item in their list.
|
||||
|
||||
@@ -345,6 +345,8 @@ public class ApplyRuneMsg extends ClientNetMsg {
|
||||
discAllowed = 3;
|
||||
break;
|
||||
case 7:
|
||||
discAllowed = 4;
|
||||
break;
|
||||
case 8:
|
||||
discAllowed = 5;
|
||||
break;
|
||||
|
||||
@@ -11,6 +11,7 @@ package engine.net.client.msg;
|
||||
|
||||
import engine.Enum.DispatchChannel;
|
||||
import engine.Enum.GuildHistoryType;
|
||||
import engine.QuestSystem.QuestManager;
|
||||
import engine.exception.MsgSendException;
|
||||
import engine.gameManager.BuildingManager;
|
||||
import engine.gameManager.DbManager;
|
||||
@@ -125,18 +126,22 @@ public class VendorDialogMsg extends ClientNetMsg {
|
||||
vd = Contract.HandleBaneCommanderOptions(msg.unknown03, npc, playerCharacter);
|
||||
msg.updateMessage(3, vd);
|
||||
}else {
|
||||
|
||||
if (contract == null)
|
||||
vd = VendorDialog.getHostileVendorDialog();
|
||||
else if (npc.getBuilding() != null) {
|
||||
if (npc.getBuilding() != null && BuildingManager.IsPlayerHostile(npc.getBuilding(), playerCharacter))
|
||||
if(QuestManager.grantsQuest(npc)){
|
||||
vd = Contract.HandleQuestOptions(msg.unknown03, npc, playerCharacter);
|
||||
msg.updateMessage(3, vd);
|
||||
}else {
|
||||
if (contract == null)
|
||||
vd = VendorDialog.getHostileVendorDialog();
|
||||
else
|
||||
else if (npc.getBuilding() != null) {
|
||||
if (npc.getBuilding() != null && BuildingManager.IsPlayerHostile(npc.getBuilding(), playerCharacter))
|
||||
vd = VendorDialog.getHostileVendorDialog();
|
||||
else
|
||||
vd = contract.getVendorDialog();
|
||||
} else
|
||||
vd = contract.getVendorDialog();
|
||||
} else
|
||||
vd = contract.getVendorDialog();
|
||||
if (vd == null)
|
||||
vd = VendorDialog.getHostileVendorDialog();
|
||||
if (vd == null)
|
||||
vd = VendorDialog.getHostileVendorDialog();
|
||||
}
|
||||
if (msg.messageType == 1 || msg.unknown03 == vd.getObjectUUID()) {
|
||||
msg.updateMessage(3, vd);
|
||||
} else {
|
||||
|
||||
@@ -68,7 +68,7 @@ public class CharacterSkill extends AbstractGameObject {
|
||||
165, 166, 166, 167, 167, //185 to 189
|
||||
168}; //190
|
||||
|
||||
static final float[] baseSkillValues = {
|
||||
private static final float[] baseSkillValues = {
|
||||
0.0f, 0.0f, 0.2f, 0.4f, 0.6f, //0 to 4
|
||||
0.8f, 1.0f, 1.1666666f, 1.3333334f, 1.5f, //5 to 9
|
||||
1.6666667f, 1.8333334f, 2.0f, 2.2f, 2.4f, //10 to 14
|
||||
|
||||
@@ -11,6 +11,7 @@ package engine.objects;
|
||||
|
||||
import ch.claude_martin.enumbitset.EnumBitSet;
|
||||
import engine.Enum;
|
||||
import engine.QuestSystem.QuestManager;
|
||||
import engine.gameManager.*;
|
||||
import engine.net.Dispatch;
|
||||
import engine.net.DispatchMessage;
|
||||
@@ -477,6 +478,21 @@ public class Contract extends AbstractGameObject {
|
||||
return vd;
|
||||
}
|
||||
|
||||
public static VendorDialog HandleQuestOptions(int optionId, NPC npc, PlayerCharacter pc){
|
||||
VendorDialog vd = new VendorDialog(npc.contract.getVendorDialog().getDialogType(),npc.contract.getVendorDialog().getIntro(),-1);
|
||||
//vd.getOptions().clear();
|
||||
switch(optionId) {
|
||||
default:
|
||||
MenuOption optionAcceptQuest = new MenuOption(25020401, "Accept Quest", 25020401);
|
||||
vd.getOptions().add(optionAcceptQuest);
|
||||
break;
|
||||
case 25020401:
|
||||
QuestManager.acceptQuest(pc,QuestManager.getQuestForContract(npc));
|
||||
break;
|
||||
}
|
||||
return vd;
|
||||
}
|
||||
|
||||
public ArrayList<Integer> getNPCMenuOptions() {
|
||||
return this.npcMenuOptions;
|
||||
}
|
||||
|
||||
@@ -1492,21 +1492,4 @@ public class Item extends AbstractWorldObject {
|
||||
return false;
|
||||
return true;
|
||||
}
|
||||
|
||||
public float getModifiedSpeed() {
|
||||
float speed = this.getItemBase().getSpeed();
|
||||
try {
|
||||
for (Effect eff : this.effects.values()) {
|
||||
for (AbstractEffectModifier mod : eff.getEffectModifiers()) {
|
||||
if (mod.modType.equals(ModType.WeaponSpeed)) {
|
||||
float modValue = 1 + mod.getPercentMod() * 0.01f;
|
||||
speed *= modValue;
|
||||
}
|
||||
}
|
||||
}
|
||||
}catch(Exception e){
|
||||
|
||||
}
|
||||
return speed;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -76,8 +76,6 @@ public class ItemBase {
|
||||
private ArrayList<Integer> animations = new ArrayList<>();
|
||||
private ArrayList<Integer> offHandAnimations = new ArrayList<>();
|
||||
|
||||
public float dexReduction = 0.0f;
|
||||
|
||||
/**
|
||||
* ResultSet Constructor
|
||||
*/
|
||||
@@ -153,7 +151,7 @@ public class ItemBase {
|
||||
}
|
||||
initBakedInStats();
|
||||
initializeHashes();
|
||||
initDexReduction();
|
||||
|
||||
}
|
||||
|
||||
public static void addToCache(ItemBase itemBase) {
|
||||
@@ -321,10 +319,6 @@ public class ItemBase {
|
||||
DbManager.ItemBaseQueries.LOAD_BAKEDINSTATS(this);
|
||||
}
|
||||
|
||||
private void initDexReduction(){
|
||||
DbManager.ItemBaseQueries.LOAD_DEX_REDUCTION(this);
|
||||
}
|
||||
|
||||
//TODO fix this later. Shouldn't be gotten from item base
|
||||
public int getMagicValue() {
|
||||
return this.value;
|
||||
|
||||
@@ -14,6 +14,7 @@ import engine.Enum;
|
||||
import engine.Enum.*;
|
||||
import engine.InterestManagement.InterestManager;
|
||||
import engine.InterestManagement.WorldGrid;
|
||||
import engine.QuestSystem.QuestManager;
|
||||
import engine.exception.SerializationException;
|
||||
import engine.gameManager.*;
|
||||
import engine.job.JobScheduler;
|
||||
@@ -1271,6 +1272,15 @@ public class Mob extends AbstractIntelligenceAgent {
|
||||
// Give XP, now handled inside the Experience Object
|
||||
if (!this.isPet() && !this.isNecroPet() && !(this.agentType.equals(AIAgentType.PET)) && !this.isPlayerGuard)
|
||||
Experience.doExperience((PlayerCharacter) attacker, this, g);
|
||||
|
||||
//handle quest updates
|
||||
PlayerCharacter pc = (PlayerCharacter)attacker;
|
||||
if(QuestManager.acceptedQuests.containsKey(pc)){
|
||||
QuestManager.acceptedQuests.get(pc).tryProgress(this.firstName);
|
||||
QuestManager.completeQuest(pc,QuestManager.acceptedQuests.get(pc));
|
||||
}
|
||||
|
||||
|
||||
} else if (attacker.getObjectType().equals(GameObjectType.Mob)) {
|
||||
Mob mobAttacker = (Mob) attacker;
|
||||
|
||||
@@ -1444,7 +1454,6 @@ public class Mob extends AbstractIntelligenceAgent {
|
||||
this.updateLocation();
|
||||
this.stopPatrolTime = 0;
|
||||
this.lastPatrolPointIndex = 0;
|
||||
InterestManager.setObjectDirty(this);
|
||||
}
|
||||
|
||||
public void despawn() {
|
||||
@@ -1699,7 +1708,7 @@ public class Mob extends AbstractIntelligenceAgent {
|
||||
}
|
||||
// calculate defense for equipment
|
||||
}
|
||||
if((this.isDropper || Mob.discDroppers.contains(this)) && !this.mobBase.getFirstName().contains("Blood Mage")){
|
||||
if(this.isDropper || Mob.discDroppers.contains(this)){
|
||||
this.defenseRating *= 2;
|
||||
this.atrHandOne *= 2;
|
||||
this.atrHandTwo *= 2;
|
||||
|
||||
@@ -27,7 +27,7 @@ import java.util.concurrent.ConcurrentHashMap;
|
||||
public class PlayerBonuses {
|
||||
|
||||
//First bonus set
|
||||
ConcurrentHashMap<AbstractEffectModifier, Float> bonusFloats = new ConcurrentHashMap<>();
|
||||
private ConcurrentHashMap<AbstractEffectModifier, Float> bonusFloats = new ConcurrentHashMap<>();
|
||||
private ConcurrentHashMap<AbstractEffectModifier, DamageShield> bonusDamageShields = new ConcurrentHashMap<>();
|
||||
private ConcurrentHashMap<AbstractEffectModifier, String> bonusStrings = new ConcurrentHashMap<>();
|
||||
private ConcurrentHashMap<ModType, HashSet<SourceType>> bonusLists = new ConcurrentHashMap<>();
|
||||
|
||||
@@ -36,7 +36,6 @@ import engine.net.client.ClientConnection;
|
||||
import engine.net.client.msg.*;
|
||||
import engine.net.client.msg.login.CommitNewCharacterMsg;
|
||||
import engine.powers.EffectsBase;
|
||||
import engine.powers.effectmodifiers.AbstractEffectModifier;
|
||||
import engine.server.MBServerStatics;
|
||||
import engine.server.login.LoginServer;
|
||||
import engine.server.login.LoginServerMsgHandler;
|
||||
@@ -180,8 +179,6 @@ public class PlayerCharacter extends AbstractCharacter {
|
||||
|
||||
public boolean isBoxed = false;
|
||||
|
||||
public PlayerCombatStats combatStats;
|
||||
|
||||
/**
|
||||
* No Id Constructor
|
||||
*/
|
||||
@@ -3840,285 +3837,6 @@ public class PlayerCharacter extends AbstractCharacter {
|
||||
}
|
||||
}
|
||||
|
||||
public void calculateATR(){
|
||||
if(this.charItemManager == null){
|
||||
this.atrHandOne = 1;
|
||||
this.atrHandTwo = 1;
|
||||
return;
|
||||
}
|
||||
for(int i = 1; i < 3; i++){
|
||||
float atr = 0;
|
||||
int primaryStat;
|
||||
Item weapon = this.charItemManager.getEquipped(i);
|
||||
ItemBase weaponBase = null;
|
||||
String skill = "Unarmed Combat";
|
||||
String mastery = "Unarmed Combat Mastery";
|
||||
|
||||
if(weapon != null) {
|
||||
weaponBase = weapon.getItemBase();
|
||||
skill = weaponBase.getSkillRequired();
|
||||
mastery = weaponBase.getMastery();
|
||||
}
|
||||
int skillPercentage = this.skills.containsKey(skill) && this.skills.get(skill) != null
|
||||
? this.skills.get(skill).getTotalSkillPercet()
|
||||
: 1;
|
||||
int masteryPercentage = this.skills.containsKey(mastery) && this.skills.get(mastery) != null
|
||||
? this.skills.get(mastery).getTotalSkillPercet()
|
||||
: 1;
|
||||
|
||||
// Determine the primary stat based on the weapon base
|
||||
if (weaponBase != null && weaponBase.isStrBased()) {
|
||||
primaryStat = this.statStrCurrent;
|
||||
} else {
|
||||
primaryStat = this.statDexCurrent;
|
||||
}
|
||||
|
||||
// Calculate ATR based on primary stat, skill, and mastery
|
||||
atr = (primaryStat * 0.5f) + (skillPercentage * 4) + (masteryPercentage * 3);
|
||||
|
||||
// Add any bonuses to ATR
|
||||
if (this.bonuses != null) {
|
||||
atr += this.bonuses.getFloat(ModType.OCV, SourceType.None);
|
||||
|
||||
// Apply positive bonus multipliers
|
||||
float pos_Bonus = (1 + this.bonuses.getFloatPercentPositive(ModType.OCV, SourceType.None));
|
||||
atr *= pos_Bonus;
|
||||
|
||||
// Apply negative bonus multipliers
|
||||
float neg_Bonus = this.bonuses.getFloatPercentNegative(ModType.OCV, SourceType.None);
|
||||
atr *= (1 + neg_Bonus);
|
||||
}
|
||||
|
||||
atr -= 2;//no idea why, need for sync
|
||||
// Ensure ATR is at least 1
|
||||
atr = (atr < 1) ? 1 : atr;
|
||||
|
||||
// Set atrHandOne
|
||||
if(i == 1)
|
||||
this.atrHandOne = (short) atr;
|
||||
else if(i == 2)
|
||||
this.atrHandTwo = (short) atr;
|
||||
}
|
||||
}
|
||||
public void calculateDamage(){
|
||||
if(this.charItemManager == null){
|
||||
this.minDamageHandOne = 1;
|
||||
this.maxDamageHandOne = 5;
|
||||
this.minDamageHandTwo = 1;
|
||||
this.maxDamageHandTwo = 5;
|
||||
return;
|
||||
}
|
||||
this.calculateMinDamage();
|
||||
this.calculateMaxDamage();
|
||||
}
|
||||
public void calculateMinDamage(){
|
||||
int baseDMG1 = 2;
|
||||
int baseDMG2 = 2;
|
||||
int weaponSkill1 = this.skills.containsKey("Unarmed Combat") && this.skills.get("Unarmed Combat") != null
|
||||
? this.skills.get("Unarmed Combat").getTotalSkillPercet()
|
||||
: 0;
|
||||
|
||||
int weaponSkill2 = this.skills.containsKey("Unarmed Combat") && this.skills.get("Unarmed Combat") != null
|
||||
? this.skills.get("Unarmed Combat").getTotalSkillPercet()
|
||||
: 0;
|
||||
|
||||
int weaponMastery1 = this.skills.containsKey("Unarmed Combat Mastery") && this.skills.get("Unarmed Combat Mastery") != null
|
||||
? this.skills.get("Unarmed Combat Mastery").getTotalSkillPercet()
|
||||
: 0;
|
||||
|
||||
int weaponMastery2 = this.skills.containsKey("Unarmed Combat Mastery") && this.skills.get("Unarmed Combat Mastery") != null
|
||||
? this.skills.get("Unarmed Combat Mastery").getTotalSkillPercet()
|
||||
: 0;
|
||||
|
||||
Item equippedRight = this.charItemManager.getEquipped(1);
|
||||
Item equippedLeft = this.charItemManager.getEquipped(2);
|
||||
|
||||
int primary1 = this.statDexCurrent;
|
||||
int secondary1 = this.statStrCurrent;
|
||||
int primary2 = this.statDexCurrent;
|
||||
int secondary2 = this.statStrCurrent;
|
||||
|
||||
if(equippedRight != null){
|
||||
baseDMG1 = equippedRight.getItemBase().getMinDamage();
|
||||
weaponSkill1 = this.skills.containsKey(equippedRight.getItemBase().getSkillRequired())
|
||||
&& this.skills.get(equippedRight.getItemBase().getSkillRequired()) != null
|
||||
? this.skills.get(equippedRight.getItemBase().getSkillRequired()).getTotalSkillPercet()
|
||||
: 0;
|
||||
|
||||
weaponMastery1 = this.skills.containsKey(equippedRight.getItemBase().getMastery())
|
||||
&& this.skills.get(equippedRight.getItemBase().getMastery()) != null
|
||||
? this.skills.get(equippedRight.getItemBase().getMastery()).getTotalSkillPercet()
|
||||
: 0;
|
||||
if(equippedRight.getItemBase().isStrBased()) {
|
||||
primary1 = this.statStrCurrent;
|
||||
secondary1 = this.statDexCurrent;
|
||||
}
|
||||
}
|
||||
if(equippedLeft != null){
|
||||
baseDMG2 = equippedLeft.getItemBase().getMinDamage();
|
||||
weaponSkill2 = this.skills.containsKey(equippedLeft.getItemBase().getSkillRequired())
|
||||
&& this.skills.get(equippedLeft.getItemBase().getSkillRequired()) != null
|
||||
? this.skills.get(equippedLeft.getItemBase().getSkillRequired()).getTotalSkillPercet()
|
||||
: 0;
|
||||
|
||||
weaponMastery2 = this.skills.containsKey(equippedLeft.getItemBase().getMastery())
|
||||
&& this.skills.get(equippedLeft.getItemBase().getMastery()) != null
|
||||
? this.skills.get(equippedLeft.getItemBase().getMastery()).getTotalSkillPercet()
|
||||
: 0;
|
||||
if(equippedLeft.getItemBase().isStrBased()) {
|
||||
primary2 = this.statStrCurrent;
|
||||
secondary2 = this.statDexCurrent;
|
||||
}
|
||||
}
|
||||
|
||||
double primaryComponent1 = 0.0048 * primary1 + 0.049 * Math.sqrt(primary1 - 0.75);
|
||||
double secondaryComponent1 = 0.0066 * secondary1 + 0.064 * Math.sqrt(secondary1 - 0.75);
|
||||
double skillComponent1 = 0.01 * (weaponSkill1 + weaponMastery1);
|
||||
|
||||
int min1 = (int)(baseDMG1 * (primaryComponent1 + secondaryComponent1 + skillComponent1));
|
||||
|
||||
double primaryComponent2 = 0.0048 * primary2 + 0.049 * Math.sqrt(primary2 - 0.75);
|
||||
double secondaryComponent2 = 0.0066 * secondary2 + 0.064 * Math.sqrt(secondary2 - 0.75);
|
||||
double skillComponent2 = 0.01 * (weaponSkill2 + weaponMastery2);
|
||||
|
||||
int min2 = (int)(baseDMG2 * (primaryComponent2 + secondaryComponent2 + skillComponent2));
|
||||
|
||||
this.minDamageHandOne = min1;
|
||||
this.minDamageHandTwo = min2;
|
||||
}
|
||||
public void calculateMaxDamage() {
|
||||
int baseDMG1 = 8;
|
||||
int baseDMG2 = 8;
|
||||
int weaponSkill1 = this.skills.containsKey("Unarmed Combat") && this.skills.get("Unarmed Combat") != null
|
||||
? this.skills.get("Unarmed Combat").getTotalSkillPercet()
|
||||
: 0;
|
||||
|
||||
int weaponSkill2 = this.skills.containsKey("Unarmed Combat") && this.skills.get("Unarmed Combat") != null
|
||||
? this.skills.get("Unarmed Combat").getTotalSkillPercet()
|
||||
: 0;
|
||||
|
||||
int weaponMastery1 = this.skills.containsKey("Unarmed Combat Mastery") && this.skills.get("Unarmed Combat Mastery") != null
|
||||
? this.skills.get("Unarmed Combat Mastery").getTotalSkillPercet()
|
||||
: 0;
|
||||
|
||||
int weaponMastery2 = this.skills.containsKey("Unarmed Combat Mastery") && this.skills.get("Unarmed Combat Mastery") != null
|
||||
? this.skills.get("Unarmed Combat Mastery").getTotalSkillPercet()
|
||||
: 0;
|
||||
|
||||
Item equippedRight = this.charItemManager.getItemFromEquipped(ItemSlotType.RHELD.ordinal());
|
||||
Item equippedLeft = this.charItemManager.getItemFromEquipped(ItemSlotType.LHELD.ordinal());
|
||||
|
||||
int primary1 = this.statDexCurrent;
|
||||
int secondary1 = this.statStrCurrent;
|
||||
int primary2 = this.statDexCurrent;
|
||||
int secondary2 = this.statStrCurrent;
|
||||
|
||||
if (equippedRight != null) {
|
||||
baseDMG1 = equippedRight.getItemBase().getMaxDamage();
|
||||
weaponSkill1 = this.skills.containsKey(equippedRight.getItemBase().getSkillRequired())
|
||||
&& this.skills.get(equippedRight.getItemBase().getSkillRequired()) != null
|
||||
? this.skills.get(equippedRight.getItemBase().getSkillRequired()).getTotalSkillPercet()
|
||||
: 1;
|
||||
|
||||
weaponMastery1 = this.skills.containsKey(equippedRight.getItemBase().getMastery())
|
||||
&& this.skills.get(equippedRight.getItemBase().getMastery()) != null
|
||||
? this.skills.get(equippedRight.getItemBase().getMastery()).getTotalSkillPercet()
|
||||
: 1;
|
||||
if (equippedRight.getItemBase().isStrBased()) {
|
||||
primary1 = this.statStrCurrent;
|
||||
secondary1 = this.statDexCurrent;
|
||||
}
|
||||
}
|
||||
|
||||
if (equippedLeft != null) {
|
||||
baseDMG2 = equippedLeft.getItemBase().getMaxDamage();
|
||||
weaponSkill2 = this.skills.containsKey(equippedLeft.getItemBase().getSkillRequired())
|
||||
&& this.skills.get(equippedLeft.getItemBase().getSkillRequired()) != null
|
||||
? this.skills.get(equippedLeft.getItemBase().getSkillRequired()).getTotalSkillPercet()
|
||||
: 1;
|
||||
|
||||
weaponMastery2 = this.skills.containsKey(equippedLeft.getItemBase().getMastery())
|
||||
&& this.skills.get(equippedLeft.getItemBase().getMastery()) != null
|
||||
? this.skills.get(equippedLeft.getItemBase().getMastery()).getTotalSkillPercet()
|
||||
: 1;
|
||||
if (equippedLeft.getItemBase().isStrBased()) {
|
||||
primary2 = this.statStrCurrent;
|
||||
secondary2 = this.statDexCurrent;
|
||||
}
|
||||
}
|
||||
|
||||
// Calculate max damage for right hand weapon
|
||||
double primaryComponent1 = 0.0124 * primary1 + 0.118 * Math.sqrt(primary1 - 0.75);
|
||||
double secondaryComponent1 = 0.0022 * secondary1 + 0.028 * Math.sqrt(secondary1 - 0.75);
|
||||
double skillComponent1 = 0.0075 * (weaponSkill1 + weaponMastery1);
|
||||
|
||||
int max1 = (int) (baseDMG1 * (primaryComponent1 + secondaryComponent1 + skillComponent1));
|
||||
|
||||
// Calculate max damage for left hand weapon
|
||||
double primaryComponent2 = 0.0124 * primary2 + 0.118 * Math.sqrt(primary2 - 0.75);
|
||||
double secondaryComponent2 = 0.0022 * secondary2 + 0.028 * Math.sqrt(secondary2 - 0.75);
|
||||
double skillComponent2 = 0.0075 * (weaponSkill2 + weaponMastery2);
|
||||
|
||||
int max2 = (int) (baseDMG2 * (primaryComponent2 + secondaryComponent2 + skillComponent2));
|
||||
|
||||
this.maxDamageHandOne = max1;
|
||||
this.maxDamageHandTwo = max2;
|
||||
}
|
||||
public void calculateSpeed(){
|
||||
if(this.charItemManager == null){
|
||||
this.speedHandOne = 20.0f;
|
||||
this.speedHandTwo = 20.0f;
|
||||
return;
|
||||
}
|
||||
|
||||
ItemBase weaponBase1 = null;
|
||||
ItemBase weaponBase2 = null;
|
||||
if(this.charItemManager.getItemFromEquipped(ItemSlotType.RHELD.ordinal()) != null){
|
||||
weaponBase1 = this.charItemManager.getItemFromEquipped(ItemSlotType.RHELD.ordinal()).getItemBase();
|
||||
}
|
||||
if(this.charItemManager.getItemFromEquipped(ItemSlotType.LHELD.ordinal()) != null){
|
||||
weaponBase2 = this.charItemManager.getItemFromEquipped(ItemSlotType.LHELD.ordinal()).getItemBase();
|
||||
}
|
||||
|
||||
float speed1;
|
||||
float speed2;
|
||||
if (weaponBase1 != null)
|
||||
speed1 = weaponBase1.getSpeed();
|
||||
else
|
||||
speed1 = 20f;
|
||||
if (weaponBase2 != null)
|
||||
speed2 = weaponBase2.getSpeed();
|
||||
else
|
||||
speed2 = 20f;
|
||||
|
||||
if(this.bonuses!= null){
|
||||
for (AbstractEffectModifier mod : this.bonuses.bonusFloats.keySet()) {
|
||||
if (mod.modType.equals(ModType.AttackDelay) || mod.modType.equals(ModType.WeaponSpeed)) {
|
||||
float modValue = 1 + mod.getPercentMod() * 0.01f;
|
||||
speed1 *= modValue;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if(this.bonuses!= null){
|
||||
for (AbstractEffectModifier mod : this.bonuses.bonusFloats.keySet()) {
|
||||
if (mod.modType.equals(ModType.AttackDelay) || mod.modType.equals(ModType.WeaponSpeed)) {
|
||||
float modValue = 1 + mod.getPercentMod() * 0.01f;
|
||||
speed2 *= modValue;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (speed1 < 10)
|
||||
speed1 = 10;
|
||||
|
||||
if (speed2 < 10)
|
||||
speed2 = 10;
|
||||
|
||||
this.speedHandOne = speed1;
|
||||
this.speedHandTwo= speed2;
|
||||
}
|
||||
|
||||
/**
|
||||
* @ Calculates Atr, and Damage for each weapon
|
||||
*/
|
||||
@@ -4145,6 +3863,9 @@ public class PlayerCharacter extends AbstractCharacter {
|
||||
float speed = 20f;
|
||||
boolean strBased = false;
|
||||
|
||||
ItemBase wbMain = (weapon != null) ? weapon.getItemBase() : null;
|
||||
ItemBase wbOff = (otherHand != null) ? otherHand.getItemBase() : null;
|
||||
|
||||
// get skill percentages and min and max damage for weapons
|
||||
if (noWeapon) {
|
||||
if (mainHand) {
|
||||
@@ -4208,6 +3929,8 @@ public class PlayerCharacter extends AbstractCharacter {
|
||||
//(Primary Stat / 2) + (Weapon Skill * 4) + (Weapon Mastery * 3) + (ATR Enchantments) * 1.stance modifier
|
||||
float atr = 0;
|
||||
int primaryStat;
|
||||
int dexMod = this.getDexMod();
|
||||
int strMod = this.getStrMod();
|
||||
if(weaponBase != null && weaponBase.isStrBased()){
|
||||
primaryStat = this.statStrCurrent;
|
||||
}else{
|
||||
@@ -4229,7 +3952,6 @@ public class PlayerCharacter extends AbstractCharacter {
|
||||
float neg_Bonus = this.bonuses.getFloatPercentNegative(ModType.OCV, SourceType.None);
|
||||
|
||||
atr *= (1 + neg_Bonus);
|
||||
|
||||
}
|
||||
|
||||
atr = (atr < 1) ? 1 : atr;
|
||||
@@ -4242,41 +3964,13 @@ public class PlayerCharacter extends AbstractCharacter {
|
||||
}
|
||||
|
||||
//calculate speed
|
||||
if (weapon != null)
|
||||
speed = weapon.getModifiedSpeed();
|
||||
if (weaponBase != null)
|
||||
speed = weaponBase.getSpeed();
|
||||
else
|
||||
speed = 20f; //unarmed attack speed
|
||||
|
||||
//if(this.effects != null) {
|
||||
// for (Effect eff : this.effects.values()) {
|
||||
// for (AbstractEffectModifier mod : eff.getEffectModifiers()) {
|
||||
// if (mod.modType.equals(ModType.WeaponSpeed)) {
|
||||
// float modValue = 1 + mod.getPercentMod() * 0.01f;
|
||||
// speed *= modValue;
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
|
||||
// for (Effect eff : this.effects.values()) {
|
||||
// for (AbstractEffectModifier mod : eff.getEffectModifiers()) {
|
||||
// if (mod.modType.equals(ModType.AttackDelay)) {
|
||||
// float modValue = 1 + mod.getPercentMod() * 0.01f;
|
||||
// speed *= modValue;
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
//}
|
||||
|
||||
if(this.bonuses!= null){
|
||||
for (AbstractEffectModifier mod : this.bonuses.bonusFloats.keySet()) {
|
||||
if (mod.modType.equals(ModType.AttackDelay)) {
|
||||
float modValue = 1 + mod.getPercentMod() * 0.01f;
|
||||
speed *= modValue;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if (weapon != null)
|
||||
speed *= (1 + this.bonuses.getFloatPercentAll(ModType.WeaponSpeed, SourceType.None));
|
||||
speed *= (1 + this.bonuses.getFloatPercentAll(ModType.AttackDelay, SourceType.None));
|
||||
if (speed < 10)
|
||||
speed = 10;
|
||||
|
||||
@@ -4354,21 +4048,16 @@ public class PlayerCharacter extends AbstractCharacter {
|
||||
|
||||
}
|
||||
|
||||
|
||||
// set damages
|
||||
if (mainHand) {
|
||||
this.minDamageHandOne = (int) minDamage;
|
||||
this.maxDamageHandOne = (int) maxDamage + 1;
|
||||
this.maxDamageHandOne = (int) maxDamage;
|
||||
this.speedHandOne = speed;
|
||||
} else {
|
||||
this.minDamageHandTwo = (int) minDamage;
|
||||
this.maxDamageHandTwo = (int) maxDamage + 1;
|
||||
this.maxDamageHandTwo = (int) maxDamage;
|
||||
this.speedHandTwo = speed;
|
||||
}
|
||||
|
||||
//this.calculateATR();
|
||||
//this.calculateDamage();
|
||||
//this.calculateSpeed();
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -4390,15 +4079,9 @@ public class PlayerCharacter extends AbstractCharacter {
|
||||
float def = ab.getDefense();
|
||||
//apply item defense bonuses
|
||||
if (shield != null) {
|
||||
//def += shield.getBonus(ModType.DR, SourceType.None);
|
||||
//def *= (1 + shield.getBonusPercent(ModType.DR, SourceType.None));
|
||||
for(Effect eff : shield.effects.values()) {
|
||||
for (AbstractEffectModifier mod : eff.getEffectModifiers()) {
|
||||
if (mod.modType.equals(ModType.DR)) {
|
||||
def += mod.minMod * (1 + (eff.getTrains() * mod.getRamp()));
|
||||
}
|
||||
}
|
||||
}
|
||||
def += shield.getBonus(ModType.DR, SourceType.None);
|
||||
def *= (1 + shield.getBonusPercent(ModType.DR, SourceType.None));
|
||||
|
||||
}
|
||||
|
||||
// float val = ((float)ab.getDefense()) * (1 + (skillMod / 100));
|
||||
@@ -4456,10 +4139,8 @@ public class PlayerCharacter extends AbstractCharacter {
|
||||
|
||||
if (!ib.getType().equals(ItemType.ARMOR))
|
||||
return 0;
|
||||
|
||||
if (ib.getSkillRequired().isEmpty())
|
||||
return ib.getDefense();
|
||||
|
||||
CharacterSkill armorSkill = this.skills.get(ib.getSkillRequired());
|
||||
if (armorSkill == null) {
|
||||
Logger.error("Player " + this.getObjectUUID()
|
||||
@@ -4470,18 +4151,8 @@ public class PlayerCharacter extends AbstractCharacter {
|
||||
float def = ib.getDefense();
|
||||
//apply item defense bonuses
|
||||
if (armor != null) {
|
||||
|
||||
for(Effect eff : armor.effects.values()){
|
||||
for(AbstractEffectModifier mod : eff.getEffectModifiers()){
|
||||
if(mod.modType.equals(ModType.DR)){
|
||||
def += mod.minMod * (1+(eff.getTrains() * mod.getRamp()));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
//def += armor.getBonus(ModType.DR, SourceType.None);
|
||||
//def *= (1 + armor.getBonusPercent(ModType.DR, SourceType.None));
|
||||
def += armor.getBonus(ModType.DR, SourceType.None);
|
||||
def *= (1 + armor.getBonusPercent(ModType.DR, SourceType.None));
|
||||
}
|
||||
|
||||
|
||||
@@ -4704,7 +4375,7 @@ public class PlayerCharacter extends AbstractCharacter {
|
||||
ModType modType = ModType.GetModType(type);
|
||||
|
||||
// must be allowed to use this passive
|
||||
if (!this.bonuses.getBool(modType, SourceType.None) && this.getRaceID() != 1999)
|
||||
if (!this.bonuses.getBool(modType, SourceType.None))
|
||||
return 0f;
|
||||
|
||||
// must not be stunned
|
||||
|
||||
@@ -1,752 +0,0 @@
|
||||
package engine.objects;
|
||||
|
||||
import engine.Enum;
|
||||
import engine.powers.effectmodifiers.AbstractEffectModifier;
|
||||
import engine.server.MBServerStatics;
|
||||
import org.pmw.tinylog.Logger;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.concurrent.ConcurrentHashMap;
|
||||
|
||||
public class PlayerCombatStats {
|
||||
|
||||
public PlayerCharacter owner;
|
||||
//main hand data
|
||||
public int minDamageHandOne;
|
||||
public int maxDamageHandOne;
|
||||
public float attackSpeedHandOne;
|
||||
public float rangeHandOne;
|
||||
public float atrHandOne;
|
||||
//off hand data
|
||||
public int minDamageHandTwo;
|
||||
public int maxDamageHandTwo;
|
||||
public float attackSpeedHandTwo;
|
||||
public float rangeHandTwo;
|
||||
public float atrHandTwo;
|
||||
//defense
|
||||
public int defense;
|
||||
//regen rates
|
||||
public float healthRegen;
|
||||
public float manaRegen;
|
||||
public float staminaRegen;
|
||||
|
||||
public PlayerCombatStats(PlayerCharacter pc) {
|
||||
this.owner = pc;
|
||||
this.update();
|
||||
}
|
||||
|
||||
public void update() {
|
||||
try {
|
||||
this.calculateATR(true);
|
||||
} catch (Exception e) {
|
||||
Logger.error("FAILED TO CALCULATE ATR FOR: " + this.owner.getObjectUUID());
|
||||
}
|
||||
try {
|
||||
this.calculateATR(false);
|
||||
} catch (Exception e) {
|
||||
Logger.error("FAILED TO CALCULATE ATR FOR: " + this.owner.getObjectUUID());
|
||||
}
|
||||
try {
|
||||
this.calculateMin(true);
|
||||
} catch (Exception e) {
|
||||
Logger.error("FAILED TO CALCULATE Min FOR: " + this.owner.getObjectUUID());
|
||||
}
|
||||
try {
|
||||
this.calculateMin(false);
|
||||
} catch (Exception e) {
|
||||
Logger.error("FAILED TO CALCULATE Min FOR: " + this.owner.getObjectUUID());
|
||||
}
|
||||
try {
|
||||
this.calculateMax(true);
|
||||
} catch (Exception e) {
|
||||
Logger.error("FAILED TO CALCULATE Max FOR: " + this.owner.getObjectUUID());
|
||||
}
|
||||
try {
|
||||
this.calculateMax(false);
|
||||
} catch (Exception e) {
|
||||
Logger.error("FAILED TO CALCULATE Max FOR: " + this.owner.getObjectUUID());
|
||||
}
|
||||
try {
|
||||
this.calculateAttackSpeed(true);
|
||||
} catch (Exception e) {
|
||||
Logger.error("FAILED TO CALCULATE Attack Speed FOR: " + this.owner.getObjectUUID());
|
||||
}
|
||||
try {
|
||||
this.calculateAttackSpeed(false);
|
||||
} catch (Exception e) {
|
||||
Logger.error("FAILED TO CALCULATE Attack Speed FOR: " + this.owner.getObjectUUID());
|
||||
}
|
||||
try {
|
||||
this.calculateAttackRange(true);
|
||||
} catch (Exception e) {
|
||||
Logger.error("FAILED TO CALCULATE Attack Range FOR: " + this.owner.getObjectUUID());
|
||||
}
|
||||
try {
|
||||
this.calculateAttackRange(false);
|
||||
} catch (Exception e) {
|
||||
Logger.error("FAILED TO CALCULATE Attack Range FOR: " + this.owner.getObjectUUID());
|
||||
}
|
||||
try {
|
||||
this.calculateRegen();
|
||||
} catch (Exception e) {
|
||||
Logger.error("FAILED TO CALCULATE Regen FOR: " + this.owner.getObjectUUID());
|
||||
}
|
||||
try {
|
||||
this.calculateDefense();
|
||||
} catch (Exception e) {
|
||||
Logger.error("FAILED TO CALCULATE Defense FOR: " + this.owner.getObjectUUID());
|
||||
}
|
||||
}
|
||||
|
||||
public void calculateATR(boolean mainHand) {
|
||||
Item weapon;
|
||||
float atr;
|
||||
|
||||
if(mainHand) {
|
||||
weapon = this.owner.charItemManager.getEquipped(1);
|
||||
}else {
|
||||
weapon = this.owner.charItemManager.getEquipped(2);
|
||||
}
|
||||
|
||||
String skill = "Unarmed Combat";
|
||||
String mastery = "Unarmed Combat Mastery";
|
||||
int primaryStat = getDexAfterPenalty(this.owner);
|
||||
if(weapon != null) {
|
||||
skill= weapon.getItemBase().getSkillRequired();
|
||||
mastery = weapon.getItemBase().getMastery();
|
||||
if(weapon.getItemBase().isStrBased())
|
||||
primaryStat = this.owner.statStrCurrent;
|
||||
}
|
||||
|
||||
float skillLevel = 0;
|
||||
float masteryLevel = 0;
|
||||
|
||||
if(this.owner.skills.containsKey(skill)) {
|
||||
skillLevel = this.owner.skills.get(skill).getModifiedAmount();
|
||||
}
|
||||
if(this.owner.skills.containsKey(mastery))
|
||||
masteryLevel = this.owner.skills.get(mastery).getModifiedAmount();
|
||||
|
||||
float stanceValue = 0.0f;
|
||||
float atrEnchants = 0;
|
||||
|
||||
for(String effID : this.owner.effects.keySet()) {
|
||||
if (effID.contains("Stance")) {
|
||||
for (AbstractEffectModifier mod : this.owner.effects.get(effID).getEffectModifiers()) {
|
||||
if (mod.modType.equals(Enum.ModType.OCV)) {
|
||||
float percent = mod.getPercentMod();
|
||||
int trains = this.owner.effects.get(effID).getTrains();
|
||||
float modValue = percent + (trains * mod.getRamp());
|
||||
stanceValue += modValue * 0.01f;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
for (AbstractEffectModifier mod : this.owner.effects.get(effID).getEffectModifiers()) {
|
||||
if (mod.modType.equals(Enum.ModType.OCV)) {
|
||||
float value = mod.getMinMod();
|
||||
int trains = this.owner.effects.get(effID).getTrains();
|
||||
float modValue = value + (trains * mod.getRamp());
|
||||
atrEnchants += modValue;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
float prefixValues = 0.0f;
|
||||
if(weapon != null){
|
||||
if(this.owner.charItemManager.getEquipped(1) != null){
|
||||
for(Effect eff : this.owner.charItemManager.getEquipped(1).effects.values()){
|
||||
for(AbstractEffectModifier mod : eff.getEffectModifiers()){
|
||||
if(mod.modType.equals(Enum.ModType.OCV)){
|
||||
prefixValues += mod.minMod + (eff.getTrains() * mod.getRamp());
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
if(this.owner.charItemManager.getEquipped(2) != null){
|
||||
for(Effect eff : this.owner.charItemManager.getEquipped(2).effects.values()){
|
||||
for(AbstractEffectModifier mod : eff.getEffectModifiers()){
|
||||
if(mod.modType.equals(Enum.ModType.OCV)){
|
||||
prefixValues += mod.minMod + (eff.getTrains() * mod.getRamp());
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
float preciseRune = 1.0f;
|
||||
for(CharacterRune rune : this.owner.runes){
|
||||
if(rune.getRuneBase().getName().equals("Precise"))
|
||||
preciseRune += 0.05f;
|
||||
}
|
||||
|
||||
if(weapon != null && weapon.getItemBase().isStrBased()){
|
||||
atr = (((primaryStat / 2) + (skillLevel * 4 + masteryLevel * 3) + prefixValues) * preciseRune + atrEnchants) * (1.0f + stanceValue);
|
||||
atr = (float) Math.round(atr);
|
||||
}else {
|
||||
float dexterity = getDexAfterPenalty(this.owner);
|
||||
atr = dexterity / 2;
|
||||
atr += skillLevel * 4;
|
||||
atr += masteryLevel * 3;
|
||||
atr += prefixValues;
|
||||
atr *= preciseRune;
|
||||
atr += atrEnchants;
|
||||
atr *= 1.0f + stanceValue;
|
||||
atr = (float) Math.round(atr);
|
||||
}
|
||||
|
||||
|
||||
|
||||
if(mainHand){
|
||||
this.atrHandOne = atr;
|
||||
}else{
|
||||
this.atrHandTwo = atr;
|
||||
if(this.owner.charItemManager.getEquipped(1) == null && this.owner.charItemManager.getEquipped(2) != null){
|
||||
if(!this.owner.charItemManager.getEquipped(2).getItemBase().isShield())
|
||||
this.atrHandOne = 0.0f;
|
||||
}else if(this.owner.charItemManager.getEquipped(2) == null && this.owner.charItemManager.getEquipped(1) != null){
|
||||
this.atrHandTwo = 0.0f;
|
||||
}
|
||||
}
|
||||
} //perfect DO NOT TOUCH
|
||||
|
||||
public void calculateMin(boolean mainHand) {
|
||||
Item weapon;
|
||||
float specialDex = this.owner.statDexBase;
|
||||
specialDex += this.owner.bonuses.getFloat(Enum.ModType.Attr, Enum.SourceType.Dexterity);
|
||||
float baseDMG = 1;
|
||||
float primaryStat = specialDex;//getDexAfterPenalty(this.owner);
|
||||
float secondaryStat = this.owner.statStrCurrent;
|
||||
double weaponSkill = 5;
|
||||
double weaponMastery = 5;
|
||||
|
||||
if (mainHand) {
|
||||
weapon = this.owner.charItemManager.getEquipped(1);
|
||||
} else {
|
||||
weapon = this.owner.charItemManager.getEquipped(2);
|
||||
}
|
||||
|
||||
String skill = "Unarmed Combat";
|
||||
String mastery = "Unarmed Combat Mastery";
|
||||
|
||||
if (weapon != null) {
|
||||
baseDMG = weapon.getItemBase().getMinDamage();
|
||||
skill = weapon.getItemBase().getSkillRequired();
|
||||
mastery = weapon.getItemBase().getMastery();
|
||||
if (weapon.getItemBase().isStrBased()) {
|
||||
primaryStat = this.owner.statStrCurrent;
|
||||
secondaryStat = specialDex;//getDexAfterPenalty(this.owner);
|
||||
}
|
||||
for(Effect eff : weapon.effects.values()){
|
||||
for(AbstractEffectModifier mod : eff.getEffectModifiers()){
|
||||
if(mod.modType.equals(Enum.ModType.MinDamage)){
|
||||
baseDMG += mod.minMod + (mod.getRamp() * eff.getTrains());
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (this.owner.skills.containsKey(skill)) {
|
||||
weaponSkill = this.owner.skills.get(skill).getTotalSkillPercet();
|
||||
}
|
||||
|
||||
if (this.owner.skills.containsKey(mastery)) {
|
||||
weaponMastery = this.owner.skills.get(mastery).getTotalSkillPercet();
|
||||
}
|
||||
|
||||
double minDMG = baseDMG * (
|
||||
0.0048 * primaryStat +
|
||||
0.049 * Math.sqrt(primaryStat - 0.75) +
|
||||
0.0066 * secondaryStat +
|
||||
0.064 * Math.sqrt(secondaryStat - 0.75) +
|
||||
0.01 * (weaponSkill + weaponMastery)
|
||||
);
|
||||
if(this.owner.bonuses != null){
|
||||
minDMG += this.owner.bonuses.getFloat(Enum.ModType.MinDamage, Enum.SourceType.None);
|
||||
minDMG *= 1 + this.owner.bonuses.getFloatPercentAll(Enum.ModType.MeleeDamageModifier, Enum.SourceType.None);
|
||||
}
|
||||
|
||||
if(this.owner.charItemManager != null){
|
||||
if(this.owner.charItemManager.getEquipped(1) != null && this.owner.charItemManager.getEquipped(2) != null && !this.owner.charItemManager.getEquipped(2).getItemBase().isShield()){
|
||||
minDMG *= 0.7f;
|
||||
}
|
||||
}
|
||||
|
||||
int roundedMin = (int)Math.round(minDMG);
|
||||
|
||||
if (mainHand) {
|
||||
this.minDamageHandOne = roundedMin;
|
||||
} else {
|
||||
this.minDamageHandTwo = roundedMin;
|
||||
if(this.owner.charItemManager.getEquipped(1) == null && this.owner.charItemManager.getEquipped(2) != null){
|
||||
if(!this.owner.charItemManager.getEquipped(2).getItemBase().isShield())
|
||||
this.minDamageHandOne = 0;
|
||||
}else if(this.owner.charItemManager.getEquipped(2) == null && this.owner.charItemManager.getEquipped(1) != null){
|
||||
this.minDamageHandTwo = 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void calculateMax(boolean mainHand) {
|
||||
//Weapon Max DMG = BaseDMG * (0.0124*Primary Stat + 0.118*(Primary Stat -0.75)^0.5
|
||||
// + 0.0022*Secondary Stat + 0.028*(Secondary Stat-0.75)^0.5 + 0.0075*(Weapon Skill + Weapon Mastery))
|
||||
Item weapon;
|
||||
float specialDex = this.owner.statDexBase;
|
||||
specialDex += this.owner.bonuses.getFloat(Enum.ModType.Attr, Enum.SourceType.Dexterity);
|
||||
double baseDMG = 5;
|
||||
float primaryStat = specialDex;//getDexAfterPenalty(this.owner);
|
||||
float secondaryStat = this.owner.statStrCurrent;
|
||||
double weaponSkill = 5;
|
||||
double weaponMastery = 5;
|
||||
|
||||
|
||||
if (mainHand) {
|
||||
weapon = this.owner.charItemManager.getEquipped(1);
|
||||
} else {
|
||||
weapon = this.owner.charItemManager.getEquipped(2);
|
||||
}
|
||||
|
||||
String skill = "Unarmed Combat";
|
||||
String mastery = "Unarmed Combat Mastery";
|
||||
if (weapon != null) {
|
||||
baseDMG = weapon.getItemBase().getMaxDamage();
|
||||
skill = weapon.getItemBase().getSkillRequired();
|
||||
mastery = weapon.getItemBase().getMastery();
|
||||
if (weapon.getItemBase().isStrBased()) {
|
||||
primaryStat = this.owner.statStrCurrent;
|
||||
secondaryStat = specialDex;//getDexAfterPenalty(this.owner);
|
||||
}
|
||||
for(Effect eff : weapon.effects.values()){
|
||||
for(AbstractEffectModifier mod : eff.getEffectModifiers()){
|
||||
if(mod.modType.equals(Enum.ModType.MaxDamage)){
|
||||
baseDMG += mod.minMod + (mod.getRamp() * eff.getTrains());
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (this.owner.skills.containsKey(skill)) {
|
||||
weaponSkill = this.owner.skills.get(skill).getModifiedAmount();
|
||||
}
|
||||
|
||||
if (this.owner.skills.containsKey(mastery)) {
|
||||
weaponMastery = this.owner.skills.get(mastery).getModifiedAmount();
|
||||
}
|
||||
|
||||
double maxDMG = baseDMG * (
|
||||
0.0124 * primaryStat +
|
||||
0.118 * Math.sqrt(primaryStat - 0.75) +
|
||||
0.0022 * secondaryStat +
|
||||
0.028 * Math.sqrt(secondaryStat - 0.75) +
|
||||
0.0075 * (weaponSkill + weaponMastery)
|
||||
);
|
||||
|
||||
if(this.owner.bonuses != null){
|
||||
maxDMG += this.owner.bonuses.getFloat(Enum.ModType.MaxDamage, Enum.SourceType.None);
|
||||
maxDMG *= 1 + this.owner.bonuses.getFloatPercentAll(Enum.ModType.MeleeDamageModifier, Enum.SourceType.None);
|
||||
}
|
||||
|
||||
if(this.owner.charItemManager != null){
|
||||
if(this.owner.charItemManager.getEquipped(1) != null && this.owner.charItemManager.getEquipped(2) != null && !this.owner.charItemManager.getEquipped(2).getItemBase().isShield()){
|
||||
maxDMG *= 0.7f;
|
||||
}
|
||||
}
|
||||
|
||||
int roundedMax = (int)(maxDMG);
|
||||
|
||||
if(mainHand){
|
||||
this.maxDamageHandOne = roundedMax;
|
||||
}else{
|
||||
this.maxDamageHandTwo = roundedMax;
|
||||
if(this.owner.charItemManager.getEquipped(1) == null && this.owner.charItemManager.getEquipped(2) != null){
|
||||
if(!this.owner.charItemManager.getEquipped(2).getItemBase().isShield())
|
||||
this.maxDamageHandOne = 0;
|
||||
}else if(this.owner.charItemManager.getEquipped(2) == null && this.owner.charItemManager.getEquipped(1) != null){
|
||||
this.maxDamageHandTwo = 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void calculateAttackSpeed(boolean mainHand){
|
||||
Item weapon;
|
||||
float speed;
|
||||
if(mainHand) {
|
||||
weapon = this.owner.charItemManager.getEquipped(1);
|
||||
}else {
|
||||
weapon = this.owner.charItemManager.getEquipped(2);
|
||||
}
|
||||
float delayExtra = 0;
|
||||
if(weapon == null) {
|
||||
speed = 20.0f;
|
||||
}else{
|
||||
speed = weapon.getItemBase().getSpeed();
|
||||
for(Effect eff : weapon.effects.values()){
|
||||
for(AbstractEffectModifier mod : eff.getEffectModifiers()){
|
||||
if(mod.modType.equals(Enum.ModType.WeaponSpeed) || mod.modType.equals(Enum.ModType.AttackDelay)){
|
||||
float percent = mod.getPercentMod();
|
||||
int trains = eff.getTrains();
|
||||
float modValue = percent + (trains * mod.getRamp());
|
||||
speed *= 1 + (modValue * 0.01f);
|
||||
if(mod.modType.equals(Enum.ModType.AttackDelay)){
|
||||
delayExtra += modValue * 0.01f;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
float stanceValue = 0.0f;
|
||||
for(String effID : this.owner.effects.keySet()){
|
||||
if(effID.contains("Stance")){
|
||||
if(this.owner.effects != null) {
|
||||
for (AbstractEffectModifier mod : this.owner.effects.get(effID).getEffectModifiers()) {
|
||||
if (mod.modType.equals(Enum.ModType.AttackDelay)) {
|
||||
float percent = mod.getPercentMod();
|
||||
int trains = this.owner.effects.get(effID).getTrains();
|
||||
float modValue = percent + (trains * mod.getRamp());
|
||||
stanceValue += modValue * 0.01f;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
float bonusValues = 1 + this.owner.bonuses.getFloatPercentAll(Enum.ModType.AttackDelay,Enum.SourceType.None);//1.0f;
|
||||
bonusValues -= stanceValue + delayExtra; // take away stance modifier from alac bonus values
|
||||
speed *= 1 + stanceValue; // apply stance bonus
|
||||
speed *= bonusValues; // apply alac bonuses without stance mod
|
||||
|
||||
if(speed < 10.0f)
|
||||
speed = 10.0f;
|
||||
|
||||
if(mainHand){
|
||||
this.attackSpeedHandOne = speed;
|
||||
}else{
|
||||
this.attackSpeedHandTwo = speed;
|
||||
if(this.owner.charItemManager.getEquipped(1) == null && this.owner.charItemManager.getEquipped(2) != null){
|
||||
if(!this.owner.charItemManager.getEquipped(2).getItemBase().isShield())
|
||||
this.attackSpeedHandOne = 0.0f;
|
||||
}else if(this.owner.charItemManager.getEquipped(2) == null && this.owner.charItemManager.getEquipped(1) != null){
|
||||
this.attackSpeedHandTwo = 0.0f;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void calculateAttackRange(boolean mainHand){
|
||||
Item weapon;
|
||||
float range;
|
||||
if(mainHand) {
|
||||
weapon = this.owner.charItemManager.getEquipped(1);
|
||||
}else {
|
||||
weapon = this.owner.charItemManager.getEquipped(2);
|
||||
}
|
||||
|
||||
if(weapon == null) {
|
||||
range = 6.0f;
|
||||
}else{
|
||||
range = weapon.getItemBase().getRange();
|
||||
}
|
||||
if(owner.bonuses != null){
|
||||
range *= 1 + this.owner.bonuses.getFloatPercentAll(Enum.ModType.WeaponRange, Enum.SourceType.None);
|
||||
}
|
||||
if(mainHand){
|
||||
this.rangeHandOne = range;
|
||||
}else{
|
||||
this.rangeHandTwo = range;
|
||||
if(this.owner.charItemManager.getEquipped(1) == null && this.owner.charItemManager.getEquipped(2) != null){
|
||||
if(!this.owner.charItemManager.getEquipped(2).getItemBase().isShield())
|
||||
this.rangeHandOne = 0.0f;
|
||||
}else if(this.owner.charItemManager.getEquipped(2) == null && this.owner.charItemManager.getEquipped(1) != null){
|
||||
this.rangeHandTwo = 0.0f;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void calculateRegen(){
|
||||
if(owner.bonuses != null){
|
||||
this.healthRegen = 1.0f + this.owner.bonuses.getFloatPercentAll(Enum.ModType.HealthRecoverRate, Enum.SourceType.None);
|
||||
this.manaRegen = 1.0f + this.owner.bonuses.getFloatPercentAll(Enum.ModType.ManaRecoverRate, Enum.SourceType.None);
|
||||
this.staminaRegen = 1.0f + this.owner.bonuses.getFloatPercentAll(Enum.ModType.StaminaRecoverRate, Enum.SourceType.None);
|
||||
|
||||
}else{
|
||||
this.healthRegen = 1.0f;
|
||||
this.manaRegen = 1.0f;
|
||||
this.staminaRegen = 1.0f;
|
||||
}
|
||||
}
|
||||
|
||||
public void calculateDefense() {
|
||||
//Defense = (1+Armor skill / 50) * Armor defense + (1 + Block skill / 100) * Shield defense + (Primary weapon skill / 2)
|
||||
// + (Weapon mastery skill/ 2) + Dexterity * 2 + Flat bonuses from rings or cloth
|
||||
float armorSkill = 0.0f;
|
||||
float armorDefense = 0.0f;
|
||||
ArrayList<String> armorsUsed = new ArrayList<>();
|
||||
for(Item equipped : this.owner.charItemManager.getEquipped().values()){
|
||||
ItemBase ib = equipped.getItemBase();
|
||||
if(ib.isHeavyArmor() || ib.isMediumArmor() || ib.isLightArmor() || ib.isClothArmor()){
|
||||
armorDefense += ib.getDefense();
|
||||
for(Effect eff : equipped.effects.values()){
|
||||
for(AbstractEffectModifier mod : eff.getEffectModifiers()){
|
||||
if(mod.modType.equals(Enum.ModType.DR)){
|
||||
armorDefense += mod.minMod + (mod.getRamp() * eff.getTrains());
|
||||
}
|
||||
}
|
||||
}
|
||||
if(!ib.isClothArmor() && !armorsUsed.contains(ib.getSkillRequired())) {
|
||||
armorsUsed.add(ib.getSkillRequired());
|
||||
}
|
||||
}
|
||||
}
|
||||
for(String armorUsed : armorsUsed){
|
||||
if(this.owner.skills.containsKey(armorUsed)) {
|
||||
armorSkill += calculateModifiedSkill(armorUsed,this.owner);
|
||||
}
|
||||
}
|
||||
if(armorsUsed.size() > 0)
|
||||
armorSkill = armorSkill / armorsUsed.size();
|
||||
|
||||
float blockSkill = 0.0f;
|
||||
if(this.owner.skills.containsKey("Block"))
|
||||
blockSkill = calculateModifiedSkill("Block",this.owner);
|
||||
|
||||
float shieldDefense = 0.0f;
|
||||
if(this.owner.charItemManager.getEquipped(2) != null && this.owner.charItemManager.getEquipped(2).getItemBase().isShield()){
|
||||
Item shield = this.owner.charItemManager.getEquipped(2);
|
||||
shieldDefense += shield.getItemBase().getDefense();
|
||||
for(Effect eff : shield.effects.values()){
|
||||
for(AbstractEffectModifier mod : eff.getEffectModifiers()){
|
||||
if(mod.modType.equals(Enum.ModType.DR)){
|
||||
shieldDefense += mod.minMod + (mod.getRamp() * eff.getTrains());
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
float weaponSkill = 0.0f;
|
||||
float masterySkill = 0.0f;
|
||||
Item weapon = this.owner.charItemManager.getEquipped(1);
|
||||
if(weapon == null){
|
||||
weapon = this.owner.charItemManager.getEquipped(2);
|
||||
}
|
||||
if(weapon != null && weapon.getItemBase().isShield())
|
||||
weapon = null;
|
||||
|
||||
String skillName = "Unarmed Combat";
|
||||
String masteryName = "Unarmed Combat Mastery";
|
||||
|
||||
if(weapon != null){
|
||||
skillName = weapon.getItemBase().getSkillRequired();
|
||||
masteryName = weapon.getItemBase().getMastery();
|
||||
}
|
||||
if(this.owner.skills.containsKey(skillName))
|
||||
weaponSkill = this.owner.skills.get(skillName).getModifiedAmount();//calculateModifiedSkill(skillName,this.owner);//this.owner.skills.get(skillName).getModifiedAmount();
|
||||
|
||||
if(this.owner.skills.containsKey(masteryName))
|
||||
masterySkill = this.owner.skills.get(masteryName).getModifiedAmount();//calculateModifiedSkill(masteryName,this.owner);//this.owner.skills.get(masteryName).getModifiedAmount();
|
||||
|
||||
float dexterity = getDexAfterPenalty(this.owner);
|
||||
|
||||
float luckyRune = 1.0f;
|
||||
for(CharacterRune rune : this.owner.runes){
|
||||
if(rune.getRuneBase().getName().equals("Lucky"))
|
||||
luckyRune += 0.05f;
|
||||
}
|
||||
|
||||
float flatBonuses = 0.0f;
|
||||
float stanceMod = 1.0f;
|
||||
for(String effID : this.owner.effects.keySet()) {
|
||||
if (effID.contains("Stance")) {
|
||||
for (AbstractEffectModifier mod : this.owner.effects.get(effID).getEffectModifiers()) {
|
||||
if (mod.modType.equals(Enum.ModType.DCV)) {
|
||||
float percent = mod.getPercentMod();
|
||||
int trains = this.owner.effects.get(effID).getTrains();
|
||||
float modValue = percent + (trains * mod.getRamp());
|
||||
stanceMod += modValue * 0.01f;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
for (AbstractEffectModifier mod : this.owner.effects.get(effID).getEffectModifiers()) {
|
||||
if (mod.modType.equals(Enum.ModType.DCV)) {
|
||||
float value = mod.getMinMod();
|
||||
int trains = this.owner.effects.get(effID).getTrains();
|
||||
float modValue = value + (trains * mod.getRamp());
|
||||
flatBonuses += modValue;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
if(this.owner.charItemManager.getEquipped(2) == null)
|
||||
blockSkill = 0;
|
||||
else if(this.owner.charItemManager != null && this.owner.charItemManager.getEquipped(2) != null && !this.owner.charItemManager.getEquipped(2).getItemBase().isShield())
|
||||
blockSkill = 0;
|
||||
|
||||
//Defense = (1+Armor skill / 50) * Armor defense + (1 + Block skill / 100) * Shield defense
|
||||
// + (Primary weapon skill / 2) + (Weapon mastery skill/ 2) + ROUND((Dexterity-Dex penalty),0) * 2 + Flat bonuses from rings or cloth
|
||||
float defense = 0;
|
||||
for(Item equipped : this.owner.charItemManager.getEquippedList()){
|
||||
ItemBase ib = equipped.getItemBase();
|
||||
if(ib.getType().equals(Enum.ItemType.ARMOR) && !ib.isShield()){
|
||||
defense += getArmorDefense(equipped,this.owner);
|
||||
}
|
||||
}
|
||||
//float defense = (1 + armorSkill / 50) * armorDefense;
|
||||
defense += (1 + blockSkill / 100) * shieldDefense;
|
||||
defense += (weaponSkill / 2);
|
||||
defense += (masterySkill / 2);
|
||||
defense += dexterity * 2;
|
||||
defense += flatBonuses;
|
||||
defense *= luckyRune;
|
||||
defense *= stanceMod;
|
||||
|
||||
defense = Math.round(defense);
|
||||
|
||||
this.defense = (int) defense;
|
||||
}
|
||||
|
||||
public static float calculateModifiedSkill(String skillName, PlayerCharacter pc) {
|
||||
|
||||
CharacterSkill skill = null;
|
||||
if (pc.skills.containsKey(skillName)) {
|
||||
skill = pc.skills.get(skillName);
|
||||
}
|
||||
SkillsBase skillBase = skill.getSkillsBase();
|
||||
if(skillBase == null)
|
||||
return 0;
|
||||
|
||||
//Get any rune bonus
|
||||
float bonus = 0f;
|
||||
if (pc.getBonuses() != null) {
|
||||
//Get bonuses from runes
|
||||
bonus = pc.getBonuses().getSkillBonus(skillBase.sourceType);
|
||||
}
|
||||
|
||||
//Get Base skill for modified stats
|
||||
float base = 7f;
|
||||
if(skillBase.getToken() == -660435875){
|
||||
base = 0;
|
||||
}
|
||||
float statMod = 0.5f;
|
||||
if (skillBase.getStrMod() > 0)
|
||||
statMod += (float) skillBase.getStrMod() * (float) pc.getStatStrCurrent() / 100f;
|
||||
if (skillBase.getDexMod() > 0)
|
||||
statMod += (float) skillBase.getDexMod() * (float) getDexAfterPenalty(pc) / 100f;
|
||||
if (skillBase.getConMod() > 0)
|
||||
statMod += (float) skillBase.getConMod() * (float) pc.getStatConCurrent() / 100f;
|
||||
if (skillBase.getIntMod() > 0)
|
||||
statMod += (float) skillBase.getIntMod() * (float) pc.getStatIntCurrent() / 100f;
|
||||
if (skillBase.getSpiMod() > 0)
|
||||
statMod += (float) skillBase.getSpiMod() * (float) pc.getStatSpiCurrent() / 100f;
|
||||
|
||||
if (statMod < 1)
|
||||
statMod = 1f;
|
||||
|
||||
if(skillBase.getToken() == -660435875){
|
||||
statMod = 0;
|
||||
}
|
||||
base += CharacterSkill.baseSkillValues[(int) statMod];
|
||||
Enum.SourceType sourceType = Enum.SourceType.GetSourceType(skillBase.getNameNoSpace());
|
||||
|
||||
//Get any rune, effect and item bonus
|
||||
|
||||
if (pc.getBonuses() != null) {
|
||||
//add bonuses from effects/items and runes
|
||||
base += bonus + pc.getBonuses().getFloat(Enum.ModType.Skill, sourceType);
|
||||
}
|
||||
float baseAmount;
|
||||
if (base < 1f && skillBase.getToken() != -660435875)
|
||||
baseAmount = 1f;
|
||||
else
|
||||
baseAmount = base;
|
||||
|
||||
int amount;
|
||||
|
||||
int trains = skill.getNumTrains();
|
||||
if (trains < 10)
|
||||
amount = (trains * 2);
|
||||
else if (trains < 90)
|
||||
amount = 10 + trains;
|
||||
else if (trains < 134)
|
||||
amount = 100 + ((trains - 90) / 2);
|
||||
else
|
||||
amount = 122 + ((trains - 134) / 3);
|
||||
|
||||
float modAmount = baseAmount + amount;
|
||||
|
||||
if (pc.getBonuses() != null) {
|
||||
//Multiply any percent bonuses
|
||||
modAmount *= (1 + pc.getBonuses().getFloatPercentAll(Enum.ModType.Skill, sourceType));
|
||||
}
|
||||
|
||||
float modifiedAmount = (float) Math.round(modAmount);
|
||||
|
||||
return modifiedAmount;
|
||||
}
|
||||
|
||||
public static int getDexAfterPenalty(PlayerCharacter pc){
|
||||
if(pc.charItemManager == null)
|
||||
return pc.statDexCurrent;
|
||||
|
||||
float dex = pc.statDexBase;
|
||||
if(pc.bonuses != null)
|
||||
dex += pc.bonuses.getFloat(Enum.ModType.Attr, Enum.SourceType.Dexterity);
|
||||
|
||||
float penaltyFactor = 0.0f;
|
||||
for(Item equipped : pc.charItemManager.getEquipped().values()){
|
||||
ItemBase ib = equipped.getItemBase();
|
||||
if(ib.isHeavyArmor() || ib.isLightArmor() || ib.isMediumArmor()){
|
||||
penaltyFactor += ib.dexReduction;
|
||||
}
|
||||
}
|
||||
|
||||
if(penaltyFactor > 0)
|
||||
penaltyFactor *= 0.01f;
|
||||
|
||||
float totalPenalty = dex * penaltyFactor;
|
||||
float returnedDex = Math.round(dex - totalPenalty);
|
||||
return (int) returnedDex;
|
||||
|
||||
}
|
||||
|
||||
private static float getArmorDefense(Item armor, PlayerCharacter pc) {
|
||||
|
||||
if (armor == null)
|
||||
return 0;
|
||||
|
||||
ItemBase ib = armor.getItemBase();
|
||||
|
||||
if (ib == null)
|
||||
return 0;
|
||||
|
||||
if (!ib.getType().equals(Enum.ItemType.ARMOR))
|
||||
return 0;
|
||||
|
||||
if (ib.getSkillRequired().isEmpty())
|
||||
return ib.getDefense();
|
||||
|
||||
CharacterSkill armorSkill = pc.skills.get(ib.getSkillRequired());
|
||||
if (armorSkill == null) {
|
||||
Logger.error("Player " + pc.getObjectUUID()
|
||||
+ " has armor equipped without the nescessary skill to equip it");
|
||||
return ib.getDefense();
|
||||
}
|
||||
|
||||
float def = ib.getDefense();
|
||||
//apply item defense bonuses
|
||||
if (armor != null) {
|
||||
|
||||
for(Effect eff : armor.effects.values()){
|
||||
for(AbstractEffectModifier mod : eff.getEffectModifiers()){
|
||||
if(mod.modType.equals(Enum.ModType.DR)){
|
||||
def += mod.minMod * (1+(eff.getTrains() * mod.getRamp()));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
//def += armor.getBonus(ModType.DR, SourceType.None);
|
||||
//def *= (1 + armor.getBonusPercent(ModType.DR, SourceType.None));
|
||||
}
|
||||
return (def * (1 + ((int) armorSkill.getModifiedAmount() / 50f)));
|
||||
}
|
||||
}
|
||||
@@ -457,9 +457,7 @@ public class Resists {
|
||||
//damage = handleFortitude(target, type, damage);
|
||||
//calculate armor piercing
|
||||
float ap = source.getBonuses().getFloatPercentAll(ModType.ArmorPiercing, SourceType.None);
|
||||
float damageAfterResists = damage;
|
||||
if(type.equals(DamageType.Pierce) || type.equals(DamageType.Crush) || type.equals(DamageType.Slash))
|
||||
damageAfterResists = damage * (1 - (this.getResist(type, trains) * 0.01f) + ap);
|
||||
float damageAfterResists = damage * (1 - (this.getResist(type, trains) * 0.01f) + ap);
|
||||
//check to see if any damage absorbers should cancel
|
||||
if (target != null) {
|
||||
//debug damage shields if any found
|
||||
|
||||
@@ -106,7 +106,7 @@ public class PeekPowerAction extends AbstractPowerAction {
|
||||
if (!tar.isAlive())
|
||||
return;
|
||||
|
||||
lwrm = new LootWindowResponseMsg(tar.getObjectType().ordinal(), tar.getObjectUUID(), tar.getInventory(false));
|
||||
lwrm = new LootWindowResponseMsg(tar.getObjectType().ordinal(), tar.getObjectUUID(), tar.getInventory(true));
|
||||
} else if (awo.getObjectType().equals(Enum.GameObjectType.Mob)) {
|
||||
|
||||
Mob tar = (Mob) awo;
|
||||
|
||||
@@ -89,8 +89,6 @@ public class StealPowerAction extends AbstractPowerAction {
|
||||
if (!sourcePlayer.isAlive())
|
||||
return;
|
||||
|
||||
sourcePlayer.cancelOnAttackSwing();
|
||||
|
||||
//prevent stealing no steal mob loot
|
||||
if (awo instanceof MobLoot && ((MobLoot) awo).noSteal())
|
||||
return;
|
||||
@@ -175,21 +173,8 @@ public class StealPowerAction extends AbstractPowerAction {
|
||||
|
||||
if (tar.getItemBase().getType().equals(ItemType.GOLD)) {
|
||||
//stealing gold
|
||||
//if (!myCIM.transferGoldToMyInventory((AbstractCharacter) owner, amount))
|
||||
// return;
|
||||
|
||||
int targetGold = ownerCIM.getGoldInventory().getNumOfItems();
|
||||
int myGold = myCIM.getGoldInventory().getNumOfItems();
|
||||
if(myGold + amount > 10000000)
|
||||
if (!myCIM.transferGoldToMyInventory((AbstractCharacter) owner, amount))
|
||||
return;
|
||||
|
||||
ownerCIM.getGoldInventory().setNumOfItems(targetGold - amount);
|
||||
ownerCIM.updateInventory();
|
||||
|
||||
myCIM.addGoldToInventory(amount,false);
|
||||
myCIM.updateInventory();
|
||||
|
||||
|
||||
} else {
|
||||
//stealing items
|
||||
if (ownerCIM.lootItemFromMe(tar, sourcePlayer, origin, true, amount) == null)
|
||||
@@ -202,9 +187,8 @@ public class StealPowerAction extends AbstractPowerAction {
|
||||
DispatchMessage.dispatchMsgDispatch(dispatch, engine.Enum.DispatchChannel.SECONDARY);
|
||||
|
||||
//update thief's inventory
|
||||
if (sourcePlayer.getCharItemManager() != null) {
|
||||
if (sourcePlayer.getCharItemManager() != null)
|
||||
sourcePlayer.getCharItemManager().updateInventory();
|
||||
}
|
||||
|
||||
//update victims inventory
|
||||
if (owner.getObjectType().equals(Enum.GameObjectType.PlayerCharacter)) {
|
||||
|
||||
@@ -14,7 +14,6 @@ import engine.gameManager.SessionManager;
|
||||
import engine.gameManager.SimulationManager;
|
||||
import engine.objects.Bane;
|
||||
import engine.objects.PlayerCharacter;
|
||||
import engine.objects.PlayerCombatStats;
|
||||
import org.pmw.tinylog.Logger;
|
||||
|
||||
public class UpdateThread implements Runnable {
|
||||
@@ -33,17 +32,6 @@ public class UpdateThread implements Runnable {
|
||||
for(PlayerCharacter player : SessionManager.getAllActivePlayerCharacters()){
|
||||
if (player != null) {
|
||||
player.doRegen();
|
||||
try {
|
||||
if (player.isAlive() && player.isActive() && player.isEnteredWorld()) {
|
||||
if (player.combatStats == null) {
|
||||
player.combatStats = new PlayerCombatStats(player);
|
||||
}
|
||||
PlayerCombatStats cStats = player.combatStats;
|
||||
cStats.update();
|
||||
}
|
||||
}catch(Exception e){
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
} catch (Exception e) {
|
||||
|
||||
Reference in New Issue
Block a user