Browse Source

BETA: Added support for CubicPower, also fixed Cubics MDAM Formula.

MELERIX 12 years ago
parent
commit
012691dbf8

+ 5 - 5
L2J_Server_BETA/java/com/l2jserver/gameserver/model/actor/instance/L2CubicInstance.java

@@ -83,7 +83,7 @@ public final class L2CubicInstance
 	protected L2Character _target;
 	
 	protected int _id;
-	protected int _matk;
+	protected int _cubicPower;
 	protected int _cubicDuration;
 	protected int _cubicDelay;
 	protected int _cubicSkillChance;
@@ -97,11 +97,11 @@ public final class L2CubicInstance
 	private Future<?> _disappearTask;
 	private Future<?> _actionTask;
 	
-	public L2CubicInstance(L2PcInstance owner, int id, int level, int mAtk, int cubicDelay, int cubicSkillChance, int cubicMaxCount, int cubicDuration, boolean givenByOther)
+	public L2CubicInstance(L2PcInstance owner, int id, int level, int cubicPower, int cubicDelay, int cubicSkillChance, int cubicMaxCount, int cubicDuration, boolean givenByOther)
 	{
 		_owner = owner;
 		_id = id;
-		_matk = mAtk;
+		_cubicPower = cubicPower;
 		_cubicDuration = cubicDuration * 1000;
 		_cubicDelay = cubicDelay * 1000;
 		_cubicSkillChance = cubicSkillChance;
@@ -274,9 +274,9 @@ public final class L2CubicInstance
 		return (int) (BaseStats.WIT.calcBonus(_owner) * 10);
 	}
 	
-	public int getMAtk()
+	public int getCubicPower()
 	{
-		return _matk;
+		return _cubicPower;
 	}
 	
 	public void stopAction()

+ 3 - 3
L2J_Server_BETA/java/com/l2jserver/gameserver/model/actor/instance/L2PcInstance.java

@@ -10265,16 +10265,16 @@ public final class L2PcInstance extends L2Playable
 	 * Add a L2CubicInstance to the L2PcInstance _cubics.
 	 * @param id
 	 * @param level
-	 * @param matk
+	 * @param cubicPower
 	 * @param cubicDelay
 	 * @param cubicSkillChance
 	 * @param cubicMaxCount
 	 * @param cubicDuration
 	 * @param givenByOther
 	 */
-	public void addCubic(int id, int level, double matk, int cubicDelay, int cubicSkillChance, int cubicMaxCount, int cubicDuration, boolean givenByOther)
+	public void addCubic(int id, int level, double cubicPower, int cubicDelay, int cubicSkillChance, int cubicMaxCount, int cubicDuration, boolean givenByOther)
 	{
-		_cubics.put(id, new L2CubicInstance(this, id, level, (int) matk, cubicDelay, cubicSkillChance, cubicMaxCount, cubicDuration, givenByOther));
+		_cubics.put(id, new L2CubicInstance(this, id, level, (int) cubicPower, cubicDelay, cubicSkillChance, cubicMaxCount, cubicDuration, givenByOther));
 	}
 	
 	/**

+ 8 - 5
L2J_Server_BETA/java/com/l2jserver/gameserver/model/skills/l2skills/L2SkillSummon.java

@@ -43,13 +43,15 @@ public class L2SkillSummon extends L2Skill
 	private final boolean _isCubic;
 	
 	// cubic AI
+	// Power for a cubic
+	private final int _cubicPower;
 	// Duration for a cubic
 	private final int _cubicDuration;
 	// Activation time for a cubic
 	private final int _cubicDelay;
-	// Maximum casts made by the cubic until it goes idle.
+	// Maximum casts made by the cubic until it goes idle
 	private final int _cubicMaxCount;
-	// Activation chance for a cubic.
+	// Activation chance for a cubic
 	private final int _cubicSkillChance;
 	
 	// What is the total lifetime of summons (in millisecs)
@@ -78,6 +80,7 @@ public class L2SkillSummon extends L2Skill
 		_expPenalty = set.getFloat("expPenalty", 0.f);
 		_isCubic = set.getBool("isCubic", false);
 		
+		_cubicPower = set.getInteger("cubicPower", 0);
 		_cubicDuration = set.getInteger("cubicDuration", 0);
 		_cubicDelay = set.getInteger("cubicDelay", 0);
 		_cubicMaxCount = set.getInteger("cubicMaxCount", -1);
@@ -203,11 +206,11 @@ public class L2SkillSummon extends L2Skill
 					}
 					if (player == activeChar)
 					{
-						player.addCubic(getNpcId(), _cubicSkillLevel, getPower(), _cubicDelay, _cubicSkillChance, _cubicMaxCount, _cubicDuration, false);
+						player.addCubic(getNpcId(), _cubicSkillLevel, _cubicPower, _cubicDelay, _cubicSkillChance, _cubicMaxCount, _cubicDuration, false);
 					}
 					else
 					{
-						player.addCubic(getNpcId(), _cubicSkillLevel, getPower(), _cubicDelay, _cubicSkillChance, _cubicMaxCount, _cubicDuration, true);
+						player.addCubic(getNpcId(), _cubicSkillLevel, _cubicPower, _cubicDelay, _cubicSkillChance, _cubicMaxCount, _cubicDuration, true);
 					}
 					player.broadcastUserInfo();
 				}
@@ -236,7 +239,7 @@ public class L2SkillSummon extends L2Skill
 					activeChar.sendPacket(SystemMessageId.CUBIC_SUMMONING_FAILED);
 					return;
 				}
-				activeChar.addCubic(getNpcId(), _cubicSkillLevel, getPower(), _cubicDelay, _cubicSkillChance, _cubicMaxCount, _cubicDuration, false);
+				activeChar.addCubic(getNpcId(), _cubicSkillLevel, _cubicPower, _cubicDelay, _cubicSkillChance, _cubicMaxCount, _cubicDuration, false);
 				activeChar.broadcastUserInfo();
 			}
 			return;

+ 10 - 10
L2J_Server_BETA/java/com/l2jserver/gameserver/model/stats/Formulas.java

@@ -987,10 +987,10 @@ public final class Formulas
 	
 	public static final double calcMagicDam(L2Character attacker, L2Character target, L2Skill skill, byte shld, boolean ss, boolean bss, boolean mcrit)
 	{
+		int mAtk = attacker.getMAtk(target, skill);
+		int mDef = target.getMDef(attacker, skill);
 		final boolean isPvP = attacker.isPlayable() && target.isPlayable();
 		final boolean isPvE = attacker.isPlayable() && target.isL2Attackable();
-		double mAtk = attacker.getMAtk(target, skill);
-		double mDef = target.getMDef(attacker, skill);
 		// --------------------------------
 		// Pvp bonuses for def
 		if (isPvP)
@@ -1022,8 +1022,8 @@ public final class Formulas
 		{
 			mAtk *= 2;
 		}
-		
-		double damage = ((91 * Math.sqrt(mAtk)) / mDef) * skill.getPower(attacker, target, isPvP, isPvE);
+		// MDAM Formula.
+		double damage = 91 * (Math.sqrt(mAtk / mDef) * skill.getPower(attacker, target, isPvP, isPvE));
 		
 		// Failure calculation
 		if (Config.ALT_GAME_MAGICFAILURES && !calcMagicSuccess(attacker, target, skill))
@@ -1126,11 +1126,10 @@ public final class Formulas
 	
 	public static final double calcMagicDam(L2CubicInstance attacker, L2Character target, L2Skill skill, boolean mcrit, byte shld)
 	{
-		// Current info include mAtk in the skill power.
-		// double mAtk = attacker.getMAtk();
+		int mAtk = attacker.getCubicPower();
+		int mDef = target.getMDef(attacker.getOwner(), skill);
 		final boolean isPvP = target.isPlayable();
 		final boolean isPvE = target.isL2Attackable();
-		double mDef = target.getMDef(attacker.getOwner(), skill);
 		
 		switch (shld)
 		{
@@ -1140,10 +1139,11 @@ public final class Formulas
 			case SHIELD_DEFENSE_PERFECT_BLOCK: // perfect block
 				return 1;
 		}
+		// Cubics MDAM Formula (similar to PDAM formula, but using 91 instead of 70, also resisted by mDef).
+		double damage = 91 * ((mAtk + skill.getPower(isPvP, isPvE)) / mDef);
 		
-		double damage = (91 /* * Math.sqrt(mAtk) *// mDef) * skill.getPower(isPvP, isPvE);
-		L2PcInstance owner = attacker.getOwner();
 		// Failure calculation
+		L2PcInstance owner = attacker.getOwner();
 		if (Config.ALT_GAME_MAGICFAILURES && !calcMagicSuccess(owner, target, skill))
 		{
 			if (calcMagicSuccess(owner, target, skill) && ((target.getLevel() - skill.getMagicLevel()) <= 9))
@@ -2248,7 +2248,7 @@ public final class Formulas
 				mAtkModifier += target.getShldDef();
 			}
 			
-			mAtkModifier = Math.pow(attacker.getMAtk() / mAtkModifier, 0.2);
+			mAtkModifier = Math.pow(attacker.getCubicPower() / mAtkModifier, 0.2);
 			
 			rate += (int) (mAtkModifier * 100) - 100;
 		}