⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 maplestateffect.java

📁 冒险岛私服Java版服务端(Odinms)源代码。学习JAVA开发的朋友
💻 JAVA
📖 第 1 页 / 共 3 页
字号:
		return hpchange;
	}
	
	private int makeHealHP (double rate, double stat, double lowerfactor, double upperfactor) {
		int maxHeal = (int) (stat * upperfactor * rate);
		int minHeal = (int) (stat * lowerfactor * rate);
		return (int) ((Math.random() * (maxHeal - minHeal + 1)) + minHeal);
	}
	
	private int calcMPChange(MapleCharacter applyfrom, boolean primary) {
		int mpchange = 0;
		if (mp != 0) {
			if (primary) {
				mpchange += alchemistModifyVal(applyfrom, mp, true);
			} else {
				mpchange += mp;
			}
		}
		if (mpR != 0) {
			mpchange += (int) (applyfrom.getCurrentMaxMp() * mpR);
		}
		if (primary) {
			if (mpCon != 0) {
				double mod = 1.0;
				boolean isAFpMage = applyfrom.getJob().isA(MapleJob.FP_MAGE);
				if (isAFpMage || applyfrom.getJob().isA(MapleJob.IL_MAGE)) {
					ISkill amp;
					if (isAFpMage) {
						amp = SkillFactory.getSkill(2110001);
					} else {
						amp = SkillFactory.getSkill(2210001);
					}
					int ampLevel = applyfrom.getSkillLevel(amp);
					if (ampLevel > 0) {
						MapleStatEffect ampStat = amp.getEffect(ampLevel);
						mod = ampStat.getX() / 100.0;
					}
				}
				mpchange -= mpCon * mod;
			}
		}
		return mpchange;
	}

	private int alchemistModifyVal (MapleCharacter chr, int val, boolean withX) {
		if (!skill && chr.getJob().isA(MapleJob.HERMIT)) {
			MapleStatEffect alchemistEffect = getAlchemistEffect(chr);
			if (alchemistEffect != null) {
				return (int) (val * ((withX ? alchemistEffect.getX() : alchemistEffect.getY()) / 100.0));
			}
		}
		return val;
	}
	
	private MapleStatEffect getAlchemistEffect (MapleCharacter chr) {
		ISkill alchemist = SkillFactory.getSkill(4110000);
		int alchemistLevel = chr.getSkillLevel(alchemist);
		if (alchemistLevel == 0) {
			return null;
		}
		return alchemist.getEffect(alchemistLevel);
	}
	
	private boolean isGmBuff() {
		switch (sourceid) {
			case 1005: // echo of hero acts like a gm buff
			case 5101000:
			case 5101001:
			case 5101002:
			case 5101003:
			case 5101005:
				return true;
			default:
				return false;
		}
	}
	
	private boolean isMonsterBuff() {
		if (!skill) {
			return false;
		}
		switch (sourceid) {
			case 1201006: // threaten
			case 2101003: // fp slow
			case 2201003: // il slow
			case 2211004: // il seal
			case 2111004: // fp seal
			case 2311005: // doom
			case 4111003: // shadow web
				return true;
		}
		return false;
	}

	private boolean isPartyBuff() {
		if (lt == null || rb == null) {
			return false;
		}
		if (sourceid >= 1211003 && sourceid <= 1211008) { // wk charges have lt and rb set but are neither player nor monster buffs
			return false;
		}
		return true;
	}
	
	public boolean isHeal() {
		return sourceid == 2301002;
	}

	public boolean isResurrection() {
		return sourceid == 5101005 || sourceid == 5001005 || sourceid == 2321006;
	}

	public short getWatk() {
		return watk;
	}

	public short getMatk() {
		return matk;
	}

	public short getWdef() {
		return wdef;
	}

	public short getMdef() {
		return mdef;
	}

	public short getAcc() {
		return acc;
	}

	public short getAvoid() {
		return avoid;
	}

	public short getHands() {
		return hands;
	}

	public short getSpeed() {
		return speed;
	}

	public short getJump() {
		return jump;
	}

	public int getDuration() {
		return duration;
	}

	public boolean isOverTime() {
		return overTime;
	}

	public List<Pair<MapleBuffStat, Integer>> getStatups() {
		return statups;
	}

	public boolean sameSource(MapleStatEffect effect) {
		return this.sourceid == effect.sourceid && this.skill == effect.skill;
	}

	public int getX() {
		return x;
	}

	public int getY() {
		return y;
	}

	public int getZ() {
		return z;
	}

	public int getDamage() {
		return damage;
	}

	public int getAttackCount() {
		return attackCount;
	}

	public int getBulletCount() {
		return bulletCount;
	}

	public int getBulletConsume() {
		return bulletConsume;
	}
	
	public int getMoneyCon() {
		return moneyCon;
	}
	
	public Map<MonsterStatus, Integer> getMonsterStati() {
		return monsterStatus;
	}

	public boolean isHide() {
		return skill && sourceid == 5101004;
	}
	
	public boolean isDragonBlood() {
		return skill && sourceid == 1311008;
	}

	private boolean isDs() {
		return skill && sourceid == 4001003;
	}

	private boolean isCombo() {
		return skill && sourceid == 1111002;
	}
	
	private boolean isEnrage() {
		return skill && sourceid == 1121010;
	}
	
	private boolean isShadowPartner() {
		return skill && sourceid == 4111002;
	}
	
	private boolean isChakra() {
		return skill && sourceid == 4211001;
	}
	
	private boolean isMonsterRiding() {
		return 	skill && sourceid == 1004;
	}
	
	public boolean isMagicDoor() {
		return skill && sourceid == 2311002;
	}

	public boolean isMesoGuard() {
		return skill && sourceid == 4211005;
	}
	
	public boolean isCharge() {
		return skill && sourceid >= 1211003 && sourceid <= 1211008;
	}
		
	public boolean isPoison() {
		return skill && (sourceid == 2111003 || sourceid == 2101005 || sourceid == 2111006);
	}
	
	private boolean isMist() {
		return skill && (sourceid == 2111003 || sourceid == 4221006); // poison mist and smokescreen
	}
	
	public SummonMovementType getSummonMovementType() {
		if (!skill) {
			return null;
		}
		switch (sourceid) {
			case 3211002: // puppet sniper
			case 3111002: // puppet ranger
				return SummonMovementType.STATIONARY;
			case 3211005: // golden eagle
			case 3111005: // golden hawk
			case 2311006: // summon dragon
			case 3221005: // frostprey
			case 3121006: // phoenix
				return SummonMovementType.CIRCLE_FOLLOW;
			case 2121005: // elquines
			case 2221005: // ifrit
			case 2321003: // bahamut
				return SummonMovementType.FOLLOW;
		}
		return null;
	}
	
	public boolean isSkill() {
		return skill;
	}
	
	public int getSourceId() {
		return sourceid;
	}
	
	/**
	 * 
	 * @return true if the effect should happen based on it's probablity, false otherwise
	 */
	public boolean makeChanceResult() {
		return prop == 1.0 || Math.random() < prop;
	}
	
	private static class CancelEffectAction implements Runnable {
		private MapleStatEffect effect;
		private WeakReference<MapleCharacter> target;
		private long startTime;

		public CancelEffectAction(MapleCharacter target, MapleStatEffect effect, long startTime) {
			this.effect = effect;
			this.target = new WeakReference<MapleCharacter>(target);
			this.startTime = startTime;
		}

		@Override
		public void run() {
			MapleCharacter realTarget = target.get();
			if (realTarget != null) {
				realTarget.cancelEffect(effect, false, startTime);
			}
		}
	}
}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -