Показать сообщение отдельно
Непрочитано 27.08.2011, 22:22   #5
Аватар для Archiel
Пользователь

По умолчанию Re: Ограничения

Сборка какая? Если L2j подобные, то в Formulas.java у вас написано примерно вот это:

Код:
public static final double calcPhysDam(L2Character attacker, L2Character target, L2Skill skill, byte shld, boolean crit, boolean dual, boolean ss)
	{
		final boolean isPvP = (attacker instanceof L2Playable) && (target instanceof L2Playable); 
		double damage = attacker.getPAtk(target);
		double defence = target.getPDef(attacker);
		damage+=calcValakasAttribute(attacker, target, skill);
		if (attacker instanceof L2Npc)
		{
			if(((L2Npc)attacker)._soulshotcharged)
			{
				ss = true;
			}
			else
				ss = false;
			((L2Npc)attacker)._soulshotcharged = false;
		}
		// Def bonusses in PvP fight
		if(isPvP)
		{
			if(skill == null)
				defence *= target.calcStat(Stats.PVP_PHYSICAL_DEF, 1, null, null);
			else
				defence *= target.calcStat(Stats.PVP_PHYS_SKILL_DEF, 1, null, null);	
		}

		switch (shld)
		{
			case SHIELD_DEFENSE_SUCCEED:
				if (!Config.ALT_GAME_SHIELD_BLOCKS)
					defence += target.getShldDef();
				break;
			case SHIELD_DEFENSE_PERFECT_BLOCK: // perfect block
				return 1.;
		}
		
		if (ss) damage *= 2;
		if (skill != null)
		{
			double skillpower = skill.getPower(attacker, isPvP);
			float ssboost = skill.getSSBoost();
			if (ssboost <= 0)
				damage += skillpower;
			else if (ssboost > 0)
			{
				if (ss)
				{
					skillpower *= ssboost;
					damage += skillpower;
				}
				else
					damage += skillpower;
			}
		}

		// defence modifier depending of the attacker weapon
		L2Weapon weapon = attacker.getActiveWeaponItem();
		Stats stat = null;
		if (weapon != null && !attacker.isTransformed())
		{
			switch (weapon.getItemType())
			{
				case BOW:
					stat = Stats.BOW_WPN_VULN;
					break;
				case CROSSBOW:
					stat = Stats.CROSSBOW_WPN_VULN;
					break;
				case BLUNT:
					stat = Stats.BLUNT_WPN_VULN;
					break;
				case DAGGER:
					stat = Stats.DAGGER_WPN_VULN;
					break;
				case DUAL:
					stat = Stats.DUAL_WPN_VULN;
					break;
				case DUALFIST:
					stat = Stats.DUALFIST_WPN_VULN;
					break;
				case ETC:
					stat = Stats.ETC_WPN_VULN;
					break;
				case FIST:
					stat = Stats.FIST_WPN_VULN;
					break;
				case POLE:
					stat = Stats.POLE_WPN_VULN;
					break;
				case SWORD:
					stat = Stats.SWORD_WPN_VULN;
					break;
				case BIGSWORD:
					stat = Stats.BIGSWORD_WPN_VULN;
					break;
				case BIGBLUNT:
					stat = Stats.BIGBLUNT_WPN_VULN;
					break;
				case DUAL_DAGGER:
					stat = Stats.DUALDAGGER_WPN_VULN;
					break;
				case RAPIER:
					stat = Stats.RAPIER_WPN_VULN;
					break;
				case ANCIENT_SWORD:
					stat = Stats.ANCIENT_WPN_VULN;
					break;
				case PET:
					stat = Stats.PET_WPN_VULN;
					break;
			}
		}
		
		if (Config.ENABLE_CLASS_BALANCE_SYSTEM)
		{
			if (target instanceof L2PcInstance && weapon != null && weapon.getItemType() == L2WeaponType.BOW && skill != null)
			{
				L2Armor armor = ((L2PcInstance) target).getActiveChestArmorItem();
				if (armor != null)
				{
					if (((L2PcInstance) target).isWearingHeavyArmor())
						damage /= Config.BOW_VS_HEAVY;
					if (((L2PcInstance) target).isWearingLightArmor())
						damage /= Config.BOW_VS_LIGHT;
					if (((L2PcInstance) target).isWearingMagicArmor())
						damage /= Config.BOW_VS_ROBE;
				}
			}
			
			if (target instanceof L2PcInstance && weapon != null && weapon.getItemType() == L2WeaponType.CROSSBOW && skill != null)
			{
				L2Armor armor = ((L2PcInstance) target).getActiveChestArmorItem();
				if (armor != null)
				{
					if (((L2PcInstance) target).isWearingHeavyArmor())
						damage /= Config.CROSSBOW_VS_HEAVY;
					if (((L2PcInstance) target).isWearingLightArmor())
						damage /= Config.CROSSBOW_VS_LIGHT;
					if (((L2PcInstance) target).isWearingMagicArmor())
						damage /= Config.CROSSBOW_VS_ROBE;
				}
			}
				
			if (target instanceof L2PcInstance && weapon != null && weapon.getItemType() == L2WeaponType.BLUNT && skill != null)
			{
				L2Armor armor = ((L2PcInstance) target).getActiveChestArmorItem();
				if (armor != null)
				{
					if (((L2PcInstance) target).isWearingHeavyArmor())
						damage /= Config.BLUNT_VS_HEAVY;
					if (((L2PcInstance) target).isWearingLightArmor())
						damage /= Config.BLUNT_VS_LIGHT;
					if (((L2PcInstance) target).isWearingMagicArmor())
						damage /= Config.BLUNT_VS_ROBE;
				}
			}
			
			if (target instanceof L2PcInstance && weapon != null && weapon.getItemType() == L2WeaponType.BIGBLUNT && skill != null)
			{
				L2Armor armor = ((L2PcInstance) target).getActiveChestArmorItem();
				if (armor != null)
				{
					if (((L2PcInstance) target).isWearingHeavyArmor())
						damage /= Config.BIGBLUNT_VS_HEAVY;
					if (((L2PcInstance) target).isWearingLightArmor())
						damage /= Config.BIGBLUNT_VS_LIGHT;
					if (((L2PcInstance) target).isWearingMagicArmor())
						damage /= Config.BIGBLUNT_VS_ROBE;
				}
			}
		
			if (target instanceof L2PcInstance && weapon != null && weapon.getItemType() == L2WeaponType.DAGGER && skill != null)
			{
				L2Armor armor = ((L2PcInstance) target).getActiveChestArmorItem();
				if (armor != null)
				{
					if (((L2PcInstance) target).isWearingHeavyArmor())
						damage /= Config.DAGGER_VS_HEAVY;
					if (((L2PcInstance) target).isWearingLightArmor())
						damage /= Config.DAGGER_VS_LIGHT;
					if (((L2PcInstance) target).isWearingMagicArmor())
						damage /= Config.DAGGER_VS_ROBE;
				}
			}
			
			if (target instanceof L2PcInstance && weapon != null && weapon.getItemType() == L2WeaponType.DUAL_DAGGER && skill != null)
			{
				L2Armor armor = ((L2PcInstance) target).getActiveChestArmorItem();
				if (armor != null)
				{
					if (((L2PcInstance) target).isWearingHeavyArmor())
						damage /= Config.DUAL_DAGGER_VS_HEAVY;
					if (((L2PcInstance) target).isWearingLightArmor())
						damage /= Config.DUAL_DAGGER_VS_LIGHT;
					if (((L2PcInstance) target).isWearingMagicArmor())
						damage /= Config.DUAL_DAGGER_VS_ROBE;
				}
			}
			
			if (target instanceof L2PcInstance && weapon != null && weapon.getItemType() == L2WeaponType.DUAL && skill != null)
			{
				L2Armor armor = ((L2PcInstance) target).getActiveChestArmorItem();
				if (armor != null)
				{
					if (((L2PcInstance) target).isWearingHeavyArmor())
						damage /= Config.DUAL_VS_HEAVY;
					if (((L2PcInstance) target).isWearingLightArmor())
						damage /= Config.DUAL_VS_LIGHT;
					if (((L2PcInstance) target).isWearingMagicArmor())
						damage /= Config.DUAL_VS_ROBE;
				}
			}
			
			if (target instanceof L2PcInstance && weapon != null && weapon.getItemType() == L2WeaponType.FIST && skill != null)
			{
				L2Armor armor = ((L2PcInstance) target).getActiveChestArmorItem();
				if (armor != null)
				{
					if (((L2PcInstance) target).isWearingHeavyArmor())
						damage /= Config.FIST_VS_HEAVY;
					if (((L2PcInstance) target).isWearingLightArmor())
						damage /= Config.FIST_VS_LIGHT;
					if (((L2PcInstance) target).isWearingMagicArmor())
						damage /= Config.FIST_VS_ROBE;
				}
			}
			
			if (target instanceof L2PcInstance && weapon != null && weapon.getItemType() == L2WeaponType.DUALFIST && skill != null)
			{
				L2Armor armor = ((L2PcInstance) target).getActiveChestArmorItem();
				if (armor != null)
				{
					if (((L2PcInstance) target).isWearingHeavyArmor())
						damage /= Config.FIST_VS_HEAVY;
					if (((L2PcInstance) target).isWearingLightArmor())
						damage /= Config.FIST_VS_LIGHT;
					if (((L2PcInstance) target).isWearingMagicArmor())
						damage /= Config.FIST_VS_ROBE;
				}
			}
			
			if (target instanceof L2PcInstance && weapon != null && weapon.getItemType() == L2WeaponType.ETC && skill != null)
			{
				L2Armor armor = ((L2PcInstance) target).getActiveChestArmorItem();
				if (armor != null)
				{
					if (((L2PcInstance) target).isWearingHeavyArmor())
						damage /= Config.ETC_VS_HEAVY;
					if (((L2PcInstance) target).isWearingLightArmor())
						damage /= Config.ETC_VS_LIGHT;
					if (((L2PcInstance) target).isWearingMagicArmor())
						damage /= Config.ETC_VS_ROBE;
				}
			}
			
			if (target instanceof L2PcInstance && weapon != null && weapon.getItemType() == L2WeaponType.POLE && skill != null)
			{
				L2Armor armor = ((L2PcInstance) target).getActiveChestArmorItem();
				if (armor != null)
				{
					if (((L2PcInstance) target).isWearingHeavyArmor())
						damage /= Config.POLE_VS_HEAVY;
					if (((L2PcInstance) target).isWearingLightArmor())
						damage /= Config.POLE_VS_LIGHT;
					if (((L2PcInstance) target).isWearingMagicArmor())
						damage /= Config.POLE_VS_ROBE;
				}
			}
			
			if (target instanceof L2PcInstance && weapon != null && weapon.getItemType() == L2WeaponType.SWORD && skill != null)
			{
				L2Armor armor = ((L2PcInstance) target).getActiveChestArmorItem();
				if (armor != null)
				{
					if (((L2PcInstance) target).isWearingHeavyArmor())
						damage /= Config.SWORD_VS_HEAVY;
					if (((L2PcInstance) target).isWearingLightArmor())
						damage /= Config.SWORD_VS_LIGHT;
					if (((L2PcInstance) target).isWearingMagicArmor())
						damage /= Config.SWORD_VS_ROBE;
				}
			}
			
			if (target instanceof L2PcInstance && weapon != null && weapon.getItemType() == L2WeaponType.BIGSWORD && skill != null)
			{
				L2Armor armor = ((L2PcInstance) target).getActiveChestArmorItem();
				if (armor != null)
				{
					if (((L2PcInstance) target).isWearingHeavyArmor())
						damage /= Config.BIGSWORD_VS_HEAVY;
					if (((L2PcInstance) target).isWearingLightArmor())
						damage /= Config.BIGSWORD_VS_LIGHT;
					if (((L2PcInstance) target).isWearingMagicArmor())
						damage /= Config.BIGSWORD_VS_ROBE;
				}
			}
			
			if (target instanceof L2PcInstance && weapon != null && weapon.getItemType() == L2WeaponType.ANCIENT_SWORD && skill != null)
			{
				L2Armor armor = ((L2PcInstance) target).getActiveChestArmorItem();
				if (armor != null)
				{
					if (((L2PcInstance) target).isWearingHeavyArmor())
						damage /= Config.ANCIENT_SWORD_VS_HEAVY;
					if (((L2PcInstance) target).isWearingLightArmor())
						damage /= Config.ANCIENT_SWORD_VS_LIGHT;
					if (((L2PcInstance) target).isWearingMagicArmor())
						damage /= Config.ANCIENT_SWORD_VS_ROBE;
				}
			}
			
			if (target instanceof L2PcInstance && weapon != null && weapon.getItemType() == L2WeaponType.RAPIER && skill != null)
			{
				L2Armor armor = ((L2PcInstance) target).getActiveChestArmorItem();
				if (armor != null)
				{
					if (((L2PcInstance) target).isWearingHeavyArmor())
						damage /= Config.RAPIER_VS_HEAVY;
					if (((L2PcInstance) target).isWearingLightArmor())
						damage /= Config.RAPIER_VS_LIGHT;
					if (((L2PcInstance) target).isWearingMagicArmor())
						damage /= Config.RAPIER_VS_ROBE;
				}
			}
		}
		
		/*if (shld && !Config.ALT_GAME_SHIELD_BLOCKS)
		{
			defence += target.getShldDef();
		}*/
		//if (!(attacker instanceof L2RaidBossInstance) &&
		/*
		if ((attacker instanceof L2NpcInstance || attacker instanceof L2SiegeGuardInstance))
		{
			if (attacker instanceof L2RaidBossInstance) damage *= 1; // was 10 changed for temp fix
			//			else
			//			damage *= 2;
			//			if (attacker instanceof L2NpcInstance || attacker instanceof L2SiegeGuardInstance){
			//damage = damage * attacker.getSTR() * attacker.getAccuracy() * 0.05 / defence;
			//			damage = damage * attacker.getSTR()* (attacker.getSTR() + attacker.getLevel()) * 0.025 / defence;
			//			damage += _rnd.nextDouble() * damage / 10 ;
		}
		*/
		//		else {
		//if (skill == null)
		
		if (crit)
		{
			//Finally retail like formula 
			damage = 2 * attacker.calcStat(Stats.CRITICAL_DAMAGE, 1, target, skill) * target.calcStat(Stats.CRIT_VULN, target.getTemplate().baseCritVuln, target, null) * (70 * damage / defence);
			//Crit dmg add is almost useless in normal hits... 
			damage += (attacker.calcStat(Stats.CRITICAL_DAMAGE_ADD, 0, target, skill) * 70 / defence);
		}
		else
			damage = 70 * damage / defence;
		
		// In C5 summons make 10 % less dmg in PvP.
		if (attacker instanceof L2Summon && target instanceof L2PcInstance)
			damage *= 0.9;

		if (stat != null)
		{
			// get the vulnerability due to skills (buffs, passives, toggles, etc)
			damage = target.calcStat(stat, damage, target, null);
			if (target instanceof L2Npc)
			{
				// get the natural vulnerability for the template
				damage *= ((L2Npc) target).getTemplate().getVulnerability(stat);
			}
		}

		damage += Rnd.nextDouble() * damage / 10;
		//		damage += _rnd.nextDouble()* attacker.getRandomDamage(target);
		//		}
		if (shld > 0 && Config.ALT_GAME_SHIELD_BLOCKS)
		{
			damage -= target.getShldDef();
			if (damage < 0) damage = 0;
		}
		
		if (target instanceof L2Npc)
		{
			switch (((L2Npc) target).getTemplate().getRace())
			{
				case BEAST:
					damage *= attacker.getPAtkMonsters(target);
					break;
				case ANIMAL:
					damage *= attacker.getPAtkAnimals(target);
					break;
				case PLANT:
					damage *= attacker.getPAtkPlants(target);
					break;
				case DRAGON:
					damage *= attacker.getPAtkDragons(target);
					break;
				case BUG:
					damage *= attacker.getPAtkInsects(target);
					break;
				case GIANT:
					damage *= attacker.getPAtkGiants(target);
					break;
				case MAGICCREATURE:
					damage *= attacker.getPAtkMCreatures(target);
					break;
				default:
					// nothing
					break;
			}
		}
		
		if (damage > 0 && damage < 1)
		{
			damage = 1;
		}
		else if (damage < 0)
		{
			damage = 0;
		}
                        else if (damage > 5000)
		{
			damage = 5000;
		}
		
		
		// Dmg bonusses in PvP fight
		if(isPvP)
		{
			if(skill == null)
				damage *= attacker.calcStat(Stats.PVP_PHYSICAL_DMG, 1, null, null);
			else
				damage *= attacker.calcStat(Stats.PVP_PHYS_SKILL_DMG, 1, null, null);	
		}
		
		damage *= calcElemental(attacker, target, skill);
		if (target instanceof L2Attackable && !target.isRaid() && !target.isRaidMinion()
				&& target.getLevel() >= Config.MIN_NPC_LVL_DMG_PENALTY && attacker.getActingPlayer() != null
				&& (target.getLevel() - attacker.getActingPlayer().getLevel()) >= 2)
			damage *= DAMAGE_REDUCTION;
			
		// Physical skill dmg boost
		if(skill != null)
			damage *= attacker.calcStat(Stats.PHYSICAL_SKILL_POWER, 1, null, null);
		
		return damage;
	}
То, что надо добавить, я выделил красным.
Archiel вне форума Отправить сообщение для Archiel с помощью ICQ Ответить с цитированием