資料庫WEAPON_SKILL新增欄位
`gfx_id` int(11) unsigned NOT NULL DEFAULT '0',
`gfx_id_target` int(1) unsigned NOT NULL DEFAULT '1',
`ref_str` int(6) NOT NULL DEFAULT '0',
`ref_int` int(6) NOT NULL DEFAULT '0',
`ref_wis` int(6) NOT NULL DEFAULT '0',
`ref_dex` int(6) NOT NULL DEFAULT '0',
`ref_con` int(6) NOT NULL DEFAULT '0',
`ref_cha` int(6) NOT NULL DEFAULT '0',
WeaponSkillTable.java
private void fillWeaponSkillTable(ResultSet rs) throws SQLException {
while (rs.next()) {
int weaponId = rs.getInt("weapon_id");
int probability = rs.getInt("probability");
int fixDamage = rs.getInt("fix_damage");
int randomDamage = rs.getInt("random_damage");
int area = rs.getInt("area");
int skillId = rs.getInt("skill_id");
int skillTime = rs.getInt("skill_time");
int effectId = rs.getInt("effect_id");
int effectTarget = rs.getInt("effect_target");
boolean isArrowType = rs.getBoolean("arrow_type");
int attr = rs.getInt("attr");
複製代碼
下面新增
付费内容 游客,您好!如果您要查看本帖隐藏内容请向楼主支付5 青币
}
}
//~修改weapon_skill table 增加顯示圖案
複製代碼
下面新增
if (randomDamage != 0) { // 隨機傷害
damage =_random.nextInt(randomDamage);
}
if (weaponSkill.getRefStr() != 0) { // 力量加成
byte Str = (byte) pc.getStr();
damage += Str * weaponSkill.getRefStr();
}
if (weaponSkill.getRefDex() != 0) { // 敏捷加成
byte Dex = (byte) pc.getDex();
damage += Dex * weaponSkill.getRefDex();
}
if (weaponSkill.getRefInt() != 0) { // 智力加成
byte Int = (byte) pc.getInt();
damage += Int * weaponSkill.getRefInt();
}
if (weaponSkill.getRefWis() != 0) { // 精神加成
byte Wis = (byte) pc.getWis();
damage += Wis * weaponSkill.getRefWis();
}
int skillTime = weaponSkill.getSkillTime();
if (skillTime > 0) {
skillTime = skillTime * 1000;
}
複製代碼
二.負面效果
能力值加成的程式碼下面,新增
switch(weaponSkill.getSkillId())
{
case 1: {//衝暈效果
//int fettersTime = 8000;
/*if (isFreeze(cha)) { // 凍結状態orカウンターマジック中
return;
}
if ((random.nextInt(100) + 1) <= 5) {*/
L1EffectSpawn.getInstance().spawnEffect(81162, skillTime,
cha.getX(), cha.getY(), cha.getMapId());
if (cha instanceof L1PcInstance) {
L1PcInstance targetPc = (L1PcInstance) cha;
targetPc.setSkillEffect(SHOCK_STUN, skillTime);
targetPc.sendPackets(new S_SkillSound(targetPc.getId(), 4184));
targetPc.broadcastPacket(new S_SkillSound(targetPc.getId(),
4184));
targetPc.sendPackets(new S_Paralysis(S_Paralysis.TYPE_STUN,
true));
} else if (cha instanceof L1MonsterInstance
|| cha instanceof L1SummonInstance
|| cha instanceof L1PetInstance) {
L1NpcInstance npc = (L1NpcInstance) cha;
npc.setSkillEffect(SHOCK_STUN, skillTime);
npc.broadcastPacket(new S_SkillSound(npc.getId(), 4184));
npc.setParalyzed(true);
}
}
break;
case 2: {//束縛效果
L1EffectSpawn.getInstance().spawnEffect(81182, skillTime,
cha.getX(), cha.getY(), cha.getMapId());
if (cha instanceof L1PcInstance) {
L1PcInstance targetPc = (L1PcInstance) cha;
targetPc.setSkillEffect(STATUS_FREEZE, skillTime);
targetPc.sendPackets(new S_SkillSound(targetPc.getId(), 4184));
targetPc.broadcastPacket(new S_SkillSound(targetPc.getId(),
4184));
targetPc.sendPackets(new S_Paralysis(S_Paralysis.TYPE_BIND,
true));
} else if (cha instanceof L1MonsterInstance
|| cha instanceof L1SummonInstance
|| cha instanceof L1PetInstance) {
L1NpcInstance npc = (L1NpcInstance) cha;
npc.setSkillEffect(STATUS_FREEZE, skillTime);
npc.broadcastPacket(new S_SkillSound(npc.getId(), 4184));
npc.setParalyzed(true);
}
}
break;
case 3: {//冰凍效果
L1EffectSpawn.getInstance().spawnEffect(81168, skillTime,
cha.getX(), cha.getY(), cha.getMapId());
if (cha instanceof L1PcInstance) {
L1PcInstance targetPc = (L1PcInstance) cha;
targetPc.setSkillEffect(ICE_LANCE, skillTime);
targetPc.sendPackets(new S_SkillSound(targetPc.getId(), 4184));
targetPc.broadcastPacket(new S_SkillSound(targetPc.getId(),
4184));
targetPc.sendPackets(new S_Paralysis(S_Paralysis.TYPE_FREEZE,
true));
} else if (cha instanceof L1MonsterInstance
|| cha instanceof L1SummonInstance
|| cha instanceof L1PetInstance) {
L1NpcInstance npc = (L1NpcInstance) cha;
npc.setSkillEffect(ICE_LANCE, skillTime);
npc.broadcastPacket(new S_SkillSound(npc.getId(), 4184));
npc.setParalyzed(true);
}
}
break;
case 4: {//沉默效果
cha.setSkillEffect(64, skillTime);
pc.sendPackets(new S_SkillSound(cha.getId(), 2177));
pc.broadcastPacket(new S_SkillSound(cha.getId(), 2177));
}
break;
case 5: {//藥霜效果
cha.setSkillEffect(71, skillTime);
pc.sendPackets(new S_SkillSound(cha.getId(), 2232));
pc.broadcastPacket(new S_SkillSound(cha.getId(), 2232));
}
break;
case 6: {//緩速效果
if (cha instanceof L1PcInstance) {
L1PcInstance player = (L1PcInstance) cha;
if (player.getHasteItemEquipped() > 0) {
return weaponSkill.getFixDamage() + damage;
}
}
if (cha.getMoveSpeed() == 0) {
if (cha instanceof L1PcInstance) {
L1PcInstance player = (L1PcInstance) cha;
player.sendPackets(new S_SkillHaste(player.getId(), 2, skillTime));
}
cha.broadcastPacket(new S_SkillHaste(cha.getId(), 2, skillTime));
cha.setMoveSpeed(2);
cha.setSkillEffect(29, skillTime);
} else if (cha.getMoveSpeed() == 1) {
int skillNum = 0;
if (cha.hasSkillEffect(43)) {
skillNum = 43;
} else if (cha.hasSkillEffect(54)) {
skillNum = 54;
} else if (cha.hasSkillEffect(1001)) {
skillNum = 1001;
}
if (skillNum != 0) {
cha.removeSkillEffect(skillNum);
cha.removeSkillEffect(29);
cha.setMoveSpeed(0);
return weaponSkill.getFixDamage() + damage;
}
} else if (cha.getMoveSpeed() == 2) {
cha.setSkillEffect(29, skillTime);
}
//pc.sendPackets(new S_SkillSound(cha.getId(), 752));
//pc.broadcastPacket(new S_SkillSound(cha.getId(), 752));
}
break;
case 7: {//毒咒效果
L1DamagePoison.doInfection(pc, cha, 2000, 30); // 2秒30點傷害
//pc.sendPackets(new S_SkillSound(cha.getId(), 745));
//pc.broadcastPacket(new S_SkillSound(cha.getId(), 745));
}
break;
case 8: {//黑暗之影
if (cha instanceof L1PcInstance) {
L1PcInstance player = (L1PcInstance) cha;
if (player.hasSkillEffect(1012)) {
player.sendPackets(new S_CurseBlind(2));
} else {
player.sendPackets(new S_CurseBlind(1));
}
}
cha.setSkillEffect(40, skillTime);
//pc.sendPackets(new S_SkillSound(cha.getId(), 2175));
//pc.broadcastPacket(new S_SkillSound(cha.getId(), 2175));
}
break;
case 9: {//壞物術
if (cha instanceof L1PcInstance) {
L1PcInstance player = (L1PcInstance) cha;
L1ItemInstance weapon = player.getWeapon();
if (weapon != null) {
int weaponDamage = _random.nextInt(pc
.getInt() / 3) + 1;
// f1????%0?損傷????。
player.sendPackets(new S_ServerMessage(268, weapon.getLogName()));
player.getInventory().receiveDamage(weapon,
weaponDamage);
}
} else {
((L1NpcInstance) cha).setWeaponBreaked(true);
}
pc.sendPackets(new S_SkillSound(cha.getId(), 172));
pc.broadcastPacket(new S_SkillSound(cha.getId(), 172));
}
break;
/*case 10: {//吸血鬼之吻
int drainHp = (weaponSkill.getFixDamage() + damage) / 2;
if (cha.getCurrentHp() < drainHp) {
drainHp = cha.getCurrentHp();
}
if ((pc.getCurrentHp() + drainHp) > pc.getMaxHp()) {
pc.setCurrentHp(pc.getMaxHp());
} else {
pc.setCurrentHp(pc.getCurrentHp() + drainHp);
}
//S_UseAttackSkill packet = new S_UseAttackSkill(pc, cha, 236, false);
//pc.sendPackets(packet);
//pc.broadcastPacket(packet);
}
break;*/
case 11: {//魔力奪取
//pc.sendPackets(new S_SkillSound(cha.getId(), 2171));
//pc.broadcastPacket(new S_SkillSound(cha.getId(), 2171));
int radMp = _random.nextInt(8) + 3;
int drainMana = radMp + (pc.getInt() / 2);
if (cha.getCurrentMp() < drainMana) {
drainMana = cha.getCurrentMp();
cha.setCurrentMp(0);
} else {
cha.setCurrentMp(cha.getCurrentMp() - drainMana);
}
if ((pc.getCurrentMp() + drainMana) > pc.getMaxMp()) {
pc.setCurrentMp(pc.getMaxMp());
} else {
pc.setCurrentMp(pc.getCurrentMp() + drainMana);
}
}
break;
case 12: {//弱化術
if (cha.hasSkillEffect(47)) {
cha.setSkillEffect(47, skillTime);
} else {
cha.addDmgup(-5);
cha.addHitup(-1);
cha.setSkillEffect(47, skillTime);
}
pc.sendPackets(new S_SkillSound(cha.getId(), 2228));
pc.broadcastPacket(new S_SkillSound(cha.getId(), 2228));
}
break;
case 13: {//疾病術
if (cha.hasSkillEffect(56)) {
cha.setSkillEffect(56, skillTime);
} else {
cha.addHitup(-6);
cha.addAc(12);
cha.setSkillEffect(56, skillTime);
}
pc.sendPackets(new S_SkillSound(cha.getId(), 2230));
pc.broadcastPacket(new S_SkillSound(cha.getId(), 2230));
}
break;
}
//負面效果判斷 end
return calcDamageReduction(pc, cha, damage, weaponSkill.getAttr());
}
複製代碼
skillId 負面效果
skillTime 負面時效
負面效果:
1 = 衝暈效果
2 = 束縛效果
3 = 冰凍效果
4 = 沉默效果
5 = 藥霜效果
6 = 緩速效果
7 = 毒咒效果
8 = 黑暗之影
9 = 壞物術
10 = 吸血鬼之吻
11 = 魔力奪取
12 = 弱化術
13 = 疾病術