首頁 > 天堂私服架設 > java核心天堂法利昂的治癒守護

java核心天堂法利昂的治癒守護

發布日期:2021/1/1

本核心內有法力昂的三招專屬技能(如果沒有的話請之後註解掉)
治癒侵蝕
藥水侵蝕
集體污水術

L1PcInstance

public void receiveDamage(L1Character attacker, double damage, boolean isMagicDamage) { // 攻撃でHPを減らすときはここを使用
if ((getCurrentHp() > 0) && !isDead()) {
if (attacker != this) {
if (!(attacker instanceof L1EffectInstance) && !knownsObject(attacker) && (attacker.getMapId() == getMapId())) {
attacker.onPerceive(this);
}
}

在往下找

if (damage > 0) {
delInvis();
if (attacker instanceof L1PcInstance) {
L1PinkName.onAction(this, attacker);


下面加入


// TODO 法利昂的治癒守護, PC部分
if ((((L1PcInstance)attacker).getWeapon() != null) && // 不可以空手
isHealGuard() && (Random.nextInt(100) < 5)) { // 5%機率, 0~99 小於5 的有5個
HealGuard.HealingEffect(this, Random.nextInt(15));
}
}else {
//TODO 法利昂的治癒守護, 非PC部分
if (isHealGuard() && (Random.nextInt(100) < 5)) { // 5%機率
HealGuard.HealingEffect(this, Random.nextInt(15));
}

最下面加入

// 法利昂的治癒守護, Heal Guard Fafurion
private boolean _isHealGuard;

public boolean isHealGuard() {
return _isHealGuard;
}

public void setHealGuard(boolean b) {
_isHealGuard = b;
}

private HealGuard HealGuard;

public void startHealGuard() {
HealGuard = new HealGuard(this);
_regenTimer.scheduleAtFixedRate(HealGuard, 1000, 180000); // 180秒
}

public void stopHealGuard() {
HealGuard.cancel();
HealGuard = null;
}

L1EquipmentSlot

private void setArmor(L1ItemInstance armor) {
L1Item item = armor.getItem();
int itemId = armor.getItem().getItemId();

下面加入

if (itemId >= 21119 && itemId <= 21122) { // 法利昂系列
_owner.setHealGuard(true);
_owner.startHealGuard();

再找

private void removeArmor(L1ItemInstance armor) {
L1Item item = armor.getItem();
int itemId = armor.getItem().getItemId();

下面加入

if ((itemId >= 21119) && (itemId <= 21122)) { // 法利昂系列
_owner.setHealGuard(false);
_owner.stopHealGuard();
}

加入一隻程式碼

位置

l1j.server.server.model.HealGuard

名子

HealGuard.java

內容

/**
* License
* THE WORK (AS DEFINED BELOW) IS PROVIDED UNDER THE TERMS OF THIS
* CREATIVE COMMONS PUBLIC LICENSE ("CCPL" OR "LICENSE").
* THE WORK IS PROTECTED BY COPYRIGHT AND/OR OTHER APPLICABLE LAW.
* ANY USE OF THE WORK OTHER THAN AS AUTHORIZED UNDER THIS LICENSE OR
* COPYRIGHT LAW IS PROHIBITED.
*
* BY EXERCISING ANY RIGHTS TO THE WORK PROVIDED HERE, YOU ACCEPT AND
* AGREE TO BE BOUND BY THE TERMS OF THIS LICENSE. TO THE EXTENT THIS LICENSE
* MAY BE CONSIDERED TO BE A CONTRACT, THE LICENSOR GRANTS YOU THE RIGHTS CONTAINED
* HERE IN CONSIDERATION OF YOUR ACCEPTANCE OF SUCH TERMS AND CONDITIONS.
*
*/
package l1j.server.server.model;

import static l1j.server.server.model.skill.L1SkillId.WATER_LIFE;
import static l1j.server.server.model.skill.L1SkillId.POLLUTE_WATER;
import static l1j.server.server.model.skill.L1SkillId.MASS_POLLUTE_WATER;

import java.util.TimerTask;
import java.util.logging.Level;
import java.util.logging.Logger;

import l1j.server.server.model.Instance.L1PcInstance;
import l1j.server.server.serverpackets.S_ServerMessage;
import l1j.server.server.serverpackets.S_SkillIconWaterLife;
import l1j.server.server.serverpackets.S_SkillSound;

public class HealGuard extends TimerTask {
private static Logger _log = Logger.getLogger(HealGuard.class.getName());

private final L1PcInstance Active_pc;

public HealGuard(L1PcInstance pc) {
Active_pc = pc;
}

@Override
public void run() {
try {
if (Active_pc.isDead()) {
return;
}
Active_pc.sendPackets(new S_SkillSound(Active_pc.getId(), 2245));
Active_pc.broadcastPacket(new S_SkillSound(Active_pc.getId(), 2245));
} catch (Throwable e) {
_log.log(Level.WARNING, e.getLocalizedMessage(), e);
}
}

public void HealingEffect(L1PcInstance _pc, int rnd) {
// 沒有施法動作
int heal_hp = rnd + 72; // 採韓版補血, 台版公式不清

if (_pc.hasSkillEffect(WATER_LIFE)) { // 水之元氣
heal_hp *= 2;
_pc.killSkillEffectTimer(WATER_LIFE);
_pc.sendPackets(new S_SkillIconWaterLife());
}
if (_pc.hasSkillEffect(POLLUTE_WATER) || // 汙濁之水
_pc.hasSkillEffect(MASS_POLLUTE_WATER)) { // 集體汙濁之水
heal_hp /= 2;
}
// 治癒侵蝕術是否有影響, 未有相關測試文, heal_hp是否 *-1 ?
_pc.setCurrentHp((heal_hp + _pc.getCurrentHp())); // maxHP 限制原L1Pc 有
_pc.sendPackets(new S_SkillSound(Active_pc.getId(), 2187));
_pc.broadcastPacket(new S_SkillSound(Active_pc.getId(), 2187)); // 他人看到
_pc.sendPackets(new S_ServerMessage(77)); // 你覺得舒服多了。
}
}