Browse Source

Project reformat

combat-2
MagicBot 8 months ago
parent
commit
ee030a690a
  1. 1
      src/engine/db/handlers/dbItemHandler.java
  2. 5
      src/engine/db/handlers/dbPlayerCharacterHandler.java
  3. 8
      src/engine/gameManager/CombatManager.java
  4. 4
      src/engine/gameManager/NPCManager.java
  5. 2
      src/engine/mobileAI/MobAI.java
  6. 5
      src/engine/net/client/handlers/ArcLoginNotifyMsgHandler.java
  7. 5
      src/engine/net/client/msg/WhoResponseMsg.java
  8. 14
      src/engine/objects/AbstractCharacter.java
  9. 2
      src/engine/objects/CharacterSkill.java
  10. 1
      src/engine/objects/ItemTemplate.java
  11. 2
      src/engine/objects/NPC.java

1
src/engine/db/handlers/dbItemHandler.java

@ -216,6 +216,7 @@ public class dbItemHandler extends dbHandlerBase { @@ -216,6 +216,7 @@ public class dbItemHandler extends dbHandlerBase {
}
}
public Item GET_ITEM(final int itemUUID) {
Item item;

5
src/engine/db/handlers/dbPlayerCharacterHandler.java

@ -11,7 +11,10 @@ package engine.db.handlers; @@ -11,7 +11,10 @@ package engine.db.handlers;
import engine.Enum;
import engine.gameManager.DbManager;
import engine.objects.*;
import engine.objects.AbstractWorldObject;
import engine.objects.Heraldry;
import engine.objects.PlayerCharacter;
import engine.objects.PlayerFriends;
import engine.server.MBServerStatics;
import org.pmw.tinylog.Logger;

8
src/engine/gameManager/CombatManager.java

@ -139,7 +139,7 @@ public enum CombatManager { @@ -139,7 +139,7 @@ public enum CombatManager {
//calculate hit chance based off ATR and DEF
int hitChance;
if(def == 0)
if (def == 0)
def = 1;
float dif = atr / def;
@ -152,7 +152,7 @@ public enum CombatManager { @@ -152,7 +152,7 @@ public enum CombatManager {
hitChance = 100;
int passiveAnim = getSwingAnimation(null, null, slot.equals(Enum.EquipSlotType.RHELD));
if(attacker.charItemManager.getEquipped().get(slot) != null){
if (attacker.charItemManager.getEquipped().get(slot) != null) {
passiveAnim = getSwingAnimation(attacker.charItemManager.getEquipped().get(slot).template, null, true);
}
@ -290,9 +290,9 @@ public enum CombatManager { @@ -290,9 +290,9 @@ public enum CombatManager {
else
((Building) target).setCurrentHitPoints(target.getCurrentHitpoints() - damage);
int attackAnim = getSwingAnimation(null,null,slot.equals(Enum.EquipSlotType.RHELD));
int attackAnim = getSwingAnimation(null, null, slot.equals(Enum.EquipSlotType.RHELD));
if (attacker.charItemManager.getEquipped().get(slot) != null) {
attackAnim = getSwingAnimation(attacker.charItemManager.getEquipped().get(slot).template,null,slot.equals(Enum.EquipSlotType.RHELD));
attackAnim = getSwingAnimation(attacker.charItemManager.getEquipped().get(slot).template, null, slot.equals(Enum.EquipSlotType.RHELD));
}
TargetedActionMsg cmm = new TargetedActionMsg(attacker, target, (float) damage, attackAnim);
DispatchMessage.sendToAllInRange(target, cmm);

4
src/engine/gameManager/NPCManager.java

@ -351,9 +351,9 @@ public enum NPCManager { @@ -351,9 +351,9 @@ public enum NPCManager {
int strength = guard.getStatStrCurrent();
int baseAtr = guard.mobBase.getAttackRating();
if (guard.charItemManager.equipped.get(Enum.EquipSlotType.RHELD) != null)
guard.atrHandOne = baseAtr + (int) ((strength * 0.5f) + ((int)guard.charItemManager.equipped.get(Enum.EquipSlotType.RHELD).template.item_skill_required.values().toArray()[0] * 4) + ((int)guard.charItemManager.equipped.get(Enum.EquipSlotType.RHELD).template.item_skill_required.values().toArray()[0] * 3));
guard.atrHandOne = baseAtr + (int) ((strength * 0.5f) + ((int) guard.charItemManager.equipped.get(Enum.EquipSlotType.RHELD).template.item_skill_required.values().toArray()[0] * 4) + ((int) guard.charItemManager.equipped.get(Enum.EquipSlotType.RHELD).template.item_skill_required.values().toArray()[0] * 3));
else if (guard.charItemManager.equipped.get(Enum.EquipSlotType.LHELD) != null && !ItemTemplate.isShield(guard.charItemManager.equipped.get(Enum.EquipSlotType.LHELD).template))
guard.atrHandTwo = baseAtr + (int) ((strength * 0.5f) + ((int)guard.charItemManager.equipped.get(Enum.EquipSlotType.LHELD).template.item_skill_required.values().toArray()[0] * 4) + ((int)guard.charItemManager.equipped.get(Enum.EquipSlotType.LHELD).template.item_skill_required.values().toArray()[0] * 3));
guard.atrHandTwo = baseAtr + (int) ((strength * 0.5f) + ((int) guard.charItemManager.equipped.get(Enum.EquipSlotType.LHELD).template.item_skill_required.values().toArray()[0] * 4) + ((int) guard.charItemManager.equipped.get(Enum.EquipSlotType.LHELD).template.item_skill_required.values().toArray()[0] * 3));
else
guard.atrHandOne = baseAtr;
}

2
src/engine/mobileAI/MobAI.java

@ -115,7 +115,7 @@ public class MobAI { @@ -115,7 +115,7 @@ public class MobAI {
if (mob.isMoving() && mob.getRange() > 20)
return;
CombatManager.combatCycle(mob,mob.combatTarget);
CombatManager.combatCycle(mob, mob.combatTarget);
}
if (target.getPet() != null)

5
src/engine/net/client/handlers/ArcLoginNotifyMsgHandler.java

@ -12,7 +12,10 @@ import engine.net.client.msg.ArcLoginNotifyMsg; @@ -12,7 +12,10 @@ import engine.net.client.msg.ArcLoginNotifyMsg;
import engine.net.client.msg.ClientNetMsg;
import engine.net.client.msg.HotzoneChangeMsg;
import engine.net.client.msg.PetMsg;
import engine.objects.*;
import engine.objects.Account;
import engine.objects.Guild;
import engine.objects.PlayerCharacter;
import engine.objects.PlayerFriends;
import engine.server.MBServerStatics;
import engine.session.Session;
import org.pmw.tinylog.Logger;

5
src/engine/net/client/msg/WhoResponseMsg.java

@ -14,7 +14,10 @@ import engine.gameManager.SessionManager; @@ -14,7 +14,10 @@ import engine.gameManager.SessionManager;
import engine.net.*;
import engine.net.client.ClientConnection;
import engine.net.client.Protocol;
import engine.objects.*;
import engine.objects.Guild;
import engine.objects.GuildStatusController;
import engine.objects.PlayerCharacter;
import engine.objects.PromotionClass;
import engine.server.MBServerStatics;
import org.pmw.tinylog.Logger;

14
src/engine/objects/AbstractCharacter.java

@ -597,7 +597,7 @@ public abstract class AbstractCharacter extends AbstractWorldObject { @@ -597,7 +597,7 @@ public abstract class AbstractCharacter extends AbstractWorldObject {
}
public static void AssignDefenseValue(AbstractCharacter abstractCharacter){
public static void AssignDefenseValue(AbstractCharacter abstractCharacter) {
ConcurrentHashMap<EquipSlotType, Item> equipped = abstractCharacter.charItemManager.getEquipped();
if (abstractCharacter.effects != null && abstractCharacter.effects.containsKey("DeathShroud"))
abstractCharacter.defenseRating = (short) 0;
@ -638,6 +638,7 @@ public abstract class AbstractCharacter extends AbstractWorldObject { @@ -638,6 +638,7 @@ public abstract class AbstractCharacter extends AbstractWorldObject {
abstractCharacter.defenseRating = (short) (defense + 0.5f);
}
}
/**
* @param abstractCharacter
* @ Calculates Atr (both hands) Defense, and Damage for pc
@ -655,12 +656,12 @@ public abstract class AbstractCharacter extends AbstractWorldObject { @@ -655,12 +656,12 @@ public abstract class AbstractCharacter extends AbstractWorldObject {
ConcurrentHashMap<EquipSlotType, Item> equipped = abstractCharacter.charItemManager.getEquipped();
AssignDamageAtrForPlayers(abstractCharacter, equipped.get(EquipSlotType.RHELD), true, equipped.get(EquipSlotType.RHELD));
AssignDamageAtrForPlayers(abstractCharacter, equipped.get(EquipSlotType.LHELD), false, equipped.get(EquipSlotType.LHELD));
if(abstractCharacter.getObjectType().equals(GameObjectType.Mob)){
if (abstractCharacter.getObjectType().equals(GameObjectType.Mob)) {
Mob mob = (Mob) abstractCharacter;
abstractCharacter.minDamageHandOne += (int)mob.mobBase.getDamageMin();
abstractCharacter.minDamageHandTwo += (int)mob.mobBase.getDamageMin();
abstractCharacter.maxDamageHandOne += (int)mob.mobBase.getDamageMax();
abstractCharacter.maxDamageHandTwo += (int)mob.mobBase.getDamageMax();
abstractCharacter.minDamageHandOne += (int) mob.mobBase.getDamageMin();
abstractCharacter.minDamageHandTwo += (int) mob.mobBase.getDamageMin();
abstractCharacter.maxDamageHandOne += (int) mob.mobBase.getDamageMax();
abstractCharacter.maxDamageHandTwo += (int) mob.mobBase.getDamageMax();
abstractCharacter.atrHandOne += mob.mobBase.getAttackRating();
abstractCharacter.atrHandTwo += mob.mobBase.getAttackRating();
abstractCharacter.defenseRating += mob.mobBase.getDefenseRating();
@ -1147,6 +1148,7 @@ public abstract class AbstractCharacter extends AbstractWorldObject { @@ -1147,6 +1148,7 @@ public abstract class AbstractCharacter extends AbstractWorldObject {
public final short getUnusedStatPoints() {
return this.unusedStatPoints;
}
@Override
public String getName() {
if (this.firstName.length() == 0 && this.lastName.length() == 0) {

2
src/engine/objects/CharacterSkill.java

@ -484,7 +484,7 @@ public class CharacterSkill extends AbstractGameObject { @@ -484,7 +484,7 @@ public class CharacterSkill extends AbstractGameObject {
if (absChar == null && absChar.getObjectType().equals(Enum.GameObjectType.PlayerCharacter) == false)
return;
PlayerCharacter pc = (PlayerCharacter)absChar;
PlayerCharacter pc = (PlayerCharacter) absChar;
ConcurrentHashMap<String, CharacterSkill> skills = pc.getSkills();

1
src/engine/objects/ItemTemplate.java

@ -23,7 +23,6 @@ public class ItemTemplate { @@ -23,7 +23,6 @@ public class ItemTemplate {
// Global template lookup
public static HashMap<Integer, ItemTemplate> templates = new HashMap<>();
public int template_id;
// Template Properties

2
src/engine/objects/NPC.java

@ -1069,7 +1069,7 @@ public class NPC extends AbstractCharacter { @@ -1069,7 +1069,7 @@ public class NPC extends AbstractCharacter {
for (Integer itemID : fullItemList) {
itemTemplate = ItemTemplate.templates.get(itemID);
if(itemTemplate.item_skill_required.values().iterator().hasNext())
if (itemTemplate.item_skill_required.values().iterator().hasNext())
skillRequired = itemTemplate.item_skill_required.values().iterator().next();
boolean exclude = skillRequired == 0 && ItemTemplate.templates.get(itemID).item_type.equals(ItemType.WEAPON);

Loading…
Cancel
Save