2013年5月15日 星期三

【Java教學】騎士魔法-反震


[教學] 被動技能~反震
不知道是不是原創啦
小弟是新手剛學核心
因為小弟要創的服是走向變態版
所以就會作一些奇奇怪怪的技能囉
這次分享的技能叫做"反震"
適合給騎士使用
在騎士遭受物理傷害時有機率反暈到敵人
版本是1118
參考衝暈及冰之石的寫法
L1Attack.java
對玩家是暈0.3~1.5秒 對NPC是暈1~5秒
找到        public int calcPcPcDamage() {

找地方加入
                //反震  by leolin310148
               int oprate = (_targetPc.getLevel())/3-10;   //機率依照等級來算
               if (_targetPc.getInventory().checkItem(310071) && ((_random.nextInt(100) + 1) <= oprate)
                               && _weaponType != 20){           //弓不會被反震
                       _targetPc.sendPackets(new S_SystemMessage("敵人被你堅硬的盔甲震盪"));
                       _pc.sendPackets(new S_SystemMessage("你被堅硬的盔甲震暈"));
                                L1Poison2 poison = new L1Poison2();
                                poison.handleCommands((L1Object) _pc, 4, 300, 0);
                               
                 _pc.add_poison2(_pc.get_poison2());
                                L1EffectSpawn.getInstance()
                                        .spawnEffect(81162, 300,
                                        _pc.getX(), _pc.getY(), _pc.getMapId());}
               else  if (_targetPc.getInventory().checkItem(310072) && ((_random.nextInt(100) + 1) <= oprate)
                               && _weaponType != 20){    //弓不會被反震
                       _targetPc.sendPackets(new S_SystemMessage("敵人被你堅硬的盔甲震盪"));
                       _pc.sendPackets(new S_SystemMessage("你被堅硬的盔甲震暈"));
                                L1Poison2 poison = new L1Poison2();
                                poison.handleCommands((L1Object) _pc, 4, 600, 0);
                               
               _pc.add_poison2(_pc.get_poison2());
                                L1EffectSpawn.getInstance()
                                        .spawnEffect(81162, 600,
                                        _pc.getX(), _pc.getY(), _pc.getMapId());}
               else if (_targetPc.getInventory().checkItem(310073) && ((_random.nextInt(100) + 1) <= oprate)
                               && _weaponType != 20){    //弓不會被反震
                       _targetPc.sendPackets(new S_SystemMessage("敵人被你堅硬的盔甲震盪"));
                       _pc.sendPackets(new S_SystemMessage("你被堅硬的盔甲震暈"));
                                L1Poison2 poison = new L1Poison2();
                                poison.handleCommands((L1Object) _pc, 4, 900, 0);
                               
               _pc.add_poison2(_pc.get_poison2());
                                L1EffectSpawn.getInstance()
                                        .spawnEffect(81162, 900,
                                        _pc.getX(), _pc.getY(), _pc.getMapId());}
               else if (_targetPc.getInventory().checkItem(310074) && ((_random.nextInt(100) + 1) <= oprate)
                               && _weaponType != 20){    //弓不會被反震
                       _targetPc.sendPackets(new S_SystemMessage("敵人被你堅硬的盔甲震盪"));
                       _pc.sendPackets(new S_SystemMessage("你被堅硬的盔甲震暈"));
                                L1Poison2 poison = new L1Poison2();
                                poison.handleCommands((L1Object) _pc, 4, 1200, 0);
                               
               _pc.add_poison2(_pc.get_poison2());
                                L1EffectSpawn.getInstance()
                                        .spawnEffect(81162, 1200,
                                        _pc.getX(), _pc.getY(), _pc.getMapId());}
               else if (_targetPc.getInventory().checkItem(310075) && ((_random.nextInt(100) + 1) <= oprate)
                               && _weaponType != 20){     //弓不會被反震
                       _targetPc.sendPackets(new S_SystemMessage("敵人被你堅硬的盔甲震盪"));
                       _pc.sendPackets(new S_SystemMessage("你被堅硬的盔甲震暈"));
                                L1Poison2 poison = new L1Poison2();
                                poison.handleCommands((L1Object) _pc, 4, 1500, 0);
                               
               _pc.add_poison2(_pc.get_poison2());
                                L1EffectSpawn.getInstance()
                                        .spawnEffect(81162, 1500,
                                        _pc.getX(), _pc.getY(), _pc.getMapId());}
                       
             
            //反震END  

在找到
        private int calcNpcPcDamage() {
找地方加入

//     反震 by  leolin310148
       int oprate = (_targetPc.getLevel())/3;
       if (_targetPc.getInventory().checkItem(310071) && ((_random.nextInt(100) + 1) <= oprate)){
               _targetPc.sendPackets(new S_SystemMessage("敵人被你堅硬的盔甲震盪"));
                        L1Poison2 poison = new L1Poison2();
                        poison.handleCommands((L1Object) _npc, 4, 1000, 0);
                       
             _npc.add_poison2(_npc.get_poison2());
                        L1EffectSpawn.getInstance()
                                .spawnEffect(81162, 1000,
                                _npc.getX(), _npc.getY(), _npc.getMapId());}
       else  if (_targetPc.getInventory().checkItem(310072) && ((_random.nextInt(100) + 1) <= oprate)){
               _targetPc.sendPackets(new S_SystemMessage("敵人被你堅硬的盔甲震盪"));
                        L1Poison2 poison = new L1Poison2();
                        poison.handleCommands((L1Object) _npc, 4, 2000, 0);
                       
           _npc.add_poison2(_npc.get_poison2());
                        L1EffectSpawn.getInstance()
                                .spawnEffect(81162, 2000,
                                _npc.getX(), _npc.getY(), _npc.getMapId());}
       else if (_targetPc.getInventory().checkItem(310073) && ((_random.nextInt(100) + 1) <= oprate)){
               _targetPc.sendPackets(new S_SystemMessage("敵人被你堅硬的盔甲震盪"));
                        L1Poison2 poison = new L1Poison2();
                        poison.handleCommands((L1Object) _npc, 4, 3000, 0);
                       
           _npc.add_poison2(_npc.get_poison2());
                        L1EffectSpawn.getInstance()
                                .spawnEffect(81162, 3000,
                                _npc.getX(), _npc.getY(), _npc.getMapId());}
       else if (_targetPc.getInventory().checkItem(310074) && ((_random.nextInt(100) + 1) <= oprate)){
               _targetPc.sendPackets(new S_SystemMessage("敵人被你堅硬的盔甲震盪"));
                        L1Poison2 poison = new L1Poison2();
                        poison.handleCommands((L1Object) _npc, 4, 4000, 0);
            _npc.add_poison2(_npc.get_poison2());
                        L1EffectSpawn.getInstance()
                                .spawnEffect(81162, 4000,
                                _npc.getX(), _npc.getY(), _npc.getMapId());}
       else if (_targetPc.getInventory().checkItem(310075) && ((_random.nextInt(100) + 1) <= oprate)){
               _targetPc.sendPackets(new S_SystemMessage("敵人被你堅硬的盔甲震盪"));
                        L1Poison2 poison = new L1Poison2();
                        poison.handleCommands((L1Object) _npc, 4, 5000, 0);
             _npc.add_poison2(_npc.get_poison2());
                        L1EffectSpawn.getInstance()
                                .spawnEffect(81162, 5000,
                                _npc.getX(), _npc.getY(), _npc.getMapId());}
               
     
    //反震END  


最後到DB的ectitem新增
310071        被動:反震LV1        被動:反震LV1        other        normal        mineral        0        3119        22        0                0        0        0        0        0        0        0        0        0        1        1        0        0        0        0        1
310072        被動:反震LV2        被動:反震LV2        other        normal        mineral        0        3119        22        0                0        0        0        0        0        0        0        0        0        1        1        0        0        0        0        1
310073        被動:反震LV3        被動:反震LV3        other        normal        mineral        0        3119        22        0                0        0        0        0        0        0        0        0        0        1        1        0        0        0        0        1
310074        被動:反震LV4        被動:反震LV4        other        normal        mineral        0        3119        22        0                0        0        0        0        0        0        0        0        0        1        1        0        0        0        0        1
310075        被動:反震LV5        被動:反震LV5        other        normal        mineral        0        3119        22        0                0        0        0        0        0        0        0        0        0        1        1        0        0        0        0        1

就完成啦


感謝觀賞
如果寫法有可以改進的地方以及有侵犯著作權的地方
麻煩告知
感謝您

沒有留言:

張貼留言