Thread: Combat system Problem [ Player vs Player ] Defence is overpowerd! [Will thank/rep]

Page 1 of 2 12 LastLast
Results 1 to 10 of 12
  1. #1 Combat system Problem [ Player vs Player ] Defence is overpowerd! [Will thank/rep] 
    Banned
    Join Date
    Jul 2013
    Posts
    142
    Thanks given
    43
    Thanks received
    11
    Rep Power
    0
    Hai people of the community,

    My server has a problem.. In the wilderness when playorz fight each other it's Like people are overdefenced you know??

    so my problems:

    - Alot of 0's ( like seriously its not even human )
    - Alot of 0's when using special attack ( Dragon claws / Dds etc. )
    - This problem is only melee related, My ranged and magic is allright .

    I really dont know how to fix this, the combat system is messy :c

    Ok rewards for the helper:

    - As I am the promotional editor of Soulsplit,Recklesspk & more big servers.. I know how to make a promo video for you, my editing skills are very good!!
    - Willing to pay, If you write me a special combat player vs player system
    - I will thank/rep/edit your server promo & Maybe help you some more!!

    Pls reply or send me a PM if you know how to help! Appreciate all help..
    Reply With Quote  
     

  2. #2  
    Software Developer

    Tyrant's Avatar
    Join Date
    Jul 2013
    Age
    24
    Posts
    1,562
    Thanks given
    678
    Thanks received
    423
    Rep Power
    1060
    Shouldn't you post your combatassistant or any other of your combat classes?

    I'd tell you to rip off a better system from a source, try take it from some populars pk sources wich has a very good combat system.

    If you want someone to make you one and actually code it for you it'd be cost alot. and I'm very sure it isn't allowed here to discuss about helping for money so it could be harder....

    Anyway my opinion is to rip one, and by the way if you wanna make me a promo vid that'd be awesome :]
    Reply With Quote  
     

  3. #3  
    Banned
    Join Date
    Jul 2013
    Posts
    142
    Thanks given
    43
    Thanks received
    11
    Rep Power
    0
    thnx but here man;

    Code:
    package server.model.players;
    
    import server.Config;
    import server.Server;
    import server.model.npcs.NPCHandler;
    import server.model.players.combat.CombatUtil;
    import server.model.players.combat.MagicInformation;
    import server.util.Misc;
    
    public class CombatAssistant {
    
       private Client c;
       public int[] def = new int[]{13, 19};
       public int[] str = new int[]{14, 19};
       public int[] atk = new int[]{1, 10, 19};
       public int[] rng = new int[]{2, 11, 19};
       public int[] mge = new int[]{3, 12, 19};
       public int[] sprt = new int[]{4, 16, 19};
       public int[] special = new int[]{15, 19};
       double[] prayerData = new double[]{1.0D, 1.0D, 1.0D, 1.0D, 1.0D, 2.0D, 2.0D, 2.0D, 0.4D, 0.6D, 0.6D, 1.5D, 2.0D, 4.0D, 4.0D, 4.0D, 4.0D, 4.0D, 4.0D, 4.0D, 4.0D, 1.0D, 2.0D, 6.0D, 8.0D, 8.0D};
       double[] curseData = new double[]{0.6D, 2.0D, 2.0D, 2.0D, 2.0D, 1.0D, 4.0D, 4.0D, 4.0D, 4.0D, 4.0D, 4.0D, 4.0D, 4.0D, 4.0D, 4.0D, 4.0D, 4.0D, 8.0D, 10.0D};
    
    
       public CombatAssistant(Client Client) {
          this.c = Client;
       }
    
       
       public void handleDfs() {
          
          if(System.currentTimeMillis() - this.c.dfsDelay > 30000L) {
             if(this.c.playerIndex > 0 && PlayerHandler.players[this.c.playerIndex] != null) {
                 Client o  = (Client) PlayerHandler.players[this.c.playerIndex];
                 
                 if(!c.inWild()) {
                     return;
                 }
                 if(!o.inWild()) {
                     return;
                 }
                 if(!c.combat.combatRequirements(o)) {
                     return;
                 }
                 
                int damage = Misc.random(15) + 5;
                this.c.startAnimation(2836);
                this.c.gfx0(600);
                PlayerHandler.players[this.c.playerIndex].playerLevel[3] -= damage;
                PlayerHandler.players[this.c.playerIndex].hitDiff2 = damage;
                PlayerHandler.players[this.c.playerIndex].hitUpdateRequired2 = true;
                PlayerHandler.players[this.c.playerIndex].updateRequired = true;
                this.c.dfsDelay = System.currentTimeMillis();
             } else {
                this.c.sendMessage("I should be in combat before using this.");
             }
          } else {
             this.c.sendMessage("My shield hasn\'t finished recharging yet.");
          }
    
       }
    
       public void handleDfsNPC() {
          if(System.currentTimeMillis() - this.c.dfsDelay > 30000L) {
             if(this.c.npcIndex > 0 && NPCHandler.npcs[this.c.npcIndex] != null) {
                int damage = Misc.random(15) + 5;
                this.c.startAnimation(2836);
                this.c.gfx0(600);
                NPCHandler.npcs[this.c.npcIndex].HP -= damage;
                NPCHandler.npcs[this.c.npcIndex].hitDiff2 = damage;
                NPCHandler.npcs[this.c.npcIndex].hitUpdateRequired2 = true;
                NPCHandler.npcs[this.c.npcIndex].updateRequired = true;
                this.c.dfsDelay = System.currentTimeMillis();
             } else {
                this.c.sendMessage("I should be in combat before using this.");
             }
          } else {
             this.c.sendMessage("My shield hasn\'t finished recharging yet.");
          }
    
       }
    
      public void resetCurse() {
    		for(int p = 0; p < c.curseActive.length; p++) {
    			c.curseActive[p] = false;
    			c.getPA().sendFrame36(c.CURSE_GLOW[p], 0);
    		}
    		c.headIcon = -1;
                    c.sendMessage("Curse reset");
    		c.getPA().requestUpdates();
    	}
    
       public void strCurse(int i) {
          for(int j = 0; j < this.str.length; ++j) {
             if(this.str[j] != i) {
                this.c.curseActive[this.str[j]] = false;
                this.c.getPA().sendFrame36(this.c.CURSE_GLOW[this.str[j]], 0);
             }
          }
    
       }
    
       public void atkCurse(int i) {
          for(int j = 0; j < this.atk.length; ++j) {
             if(this.atk[j] != i) {
                this.c.curseActive[this.atk[j]] = false;
                this.c.getPA().sendFrame36(this.c.CURSE_GLOW[this.atk[j]], 0);
             }
          }
    
       }
    
       public void defCurse(int i) {
          for(int j = 0; j < this.def.length; ++j) {
             if(this.def[j] != i) {
                this.c.curseActive[this.def[j]] = false;
                this.c.getPA().sendFrame36(this.c.CURSE_GLOW[this.def[j]], 0);
             }
          }
    
       }
    
       public void rngCurse(int i) {
          for(int j = 0; j < this.rng.length; ++j) {
             if(this.rng[j] != i) {
                this.c.curseActive[this.rng[j]] = false;
                this.c.getPA().sendFrame36(this.c.CURSE_GLOW[this.rng[j]], 0);
             }
          }
    
       }
    
       public void mgeCurse(int i) {
          for(int j = 0; j < this.mge.length; ++j) {
             if(this.mge[j] != i) {
                this.c.curseActive[this.mge[j]] = false;
                this.c.getPA().sendFrame36(this.c.CURSE_GLOW[this.mge[j]], 0);
             }
          }
    
       }
    
       public void sprtCurse(int i) {
          for(int j = 0; j < this.sprt.length; ++j) {
             if(this.sprt[j] != i) {
                this.c.curseActive[this.sprt[j]] = false;
                this.c.getPA().sendFrame36(this.c.CURSE_GLOW[this.sprt[j]], 0);
             }
          }
    
       }
    
       public void specialCurse(int i) {
          for(int j = 0; j < this.special.length; ++j) {
             if(this.special[j] != i) {
                this.c.curseActive[this.special[j]] = false;
                this.c.getPA().sendFrame36(this.c.CURSE_GLOW[this.special[j]], 0);
             }
          }
    
       }
    
       	public void activateCurse(int i) {
    		if(c.normalPrayer){
    			c.sendMessage("You must be on ancient prayer book to activate this prayer.");
    			return;			
    		}
    		//c.sendMessage("curse number: "+i);
    		if(c.duelRule[7]) {
    			resetCurse();
    			c.sendMessage("Prayer has been disabled in this duel!");
    			return;
    		}
    		if (c.absX >= 1889 && c.absX <= 1910 && c.absY >= 5345 && c.absY <= 5366) {
    			c.sendMessage("You may not pray in this minigame.");
    			c.getPA().sendFrame36(c.CURSE_GLOW[i], 0);
    			return;
    		}
    		if (c.playerLevel[1] < 30) {
    			c.getPA().sendFrame36(c.CURSE_GLOW[i], 0);
    			c.sendMessage("You need 30 Defence to use this prayer.");
    			return;
    		}
    		//0 = pItem//1 = sapWar//2 = sapRng//3 = sapMge//4 = sapSprt
    		//5 = berserk//6 = defSum//7 = defMge//8 = defRng//9 = defMel
    		//10 = leechAtk//11 = leechRng//12 = leechMge//13 = leechDef//14 = leechStr
    		//15 = leechEnrgy//16 = leechSpec//17 = wrath//18 = soul//19 = turmoil
    		
    		if(c.playerLevel[5] > 0 || !Config.PRAYER_POINTS_REQUIRED) {
    			if(c.getPA().getLevelForXP(c.playerXP[5]) >= c.CURSE_LEVEL_REQUIRED[i] || !Config.PRAYER_LEVEL_REQUIRED) {
    				boolean headIcon = false;
    				switch(i) {
    					case 0://pItem
    						if(c.prayerActive[10] == false) {
    						c.prayerActive[10] = true;
    						c.lastProtItem = System.currentTimeMillis();
    						} else {
    						c.prayerActive[10] = false;
    						}
    					break;
    					case 5:
    						c.startAnimation(12589);
    						c.gfx0(2266);
    						break;
    
    					case 1:
    				
    						if (c.curseActive[i] == false){ 
    							atkCurse(i); 
    						}
    					break;
    					
    					case 10:
    						if (c.curseActive[i] == false) {
    							atkCurse(i); 
    						}
    					break;
    					
    					case 2:
    					case 11:
    						if (c.curseActive[i] == false) {
    							rngCurse(i); 
    						}
    					break;
    					
    					case 3:
    					case 12:
    						if (c.curseActive[i] == false) {
    							mgeCurse(i); 
    						}
    					break;
    					
    					case 4:
    					case 16:
    						if (c.curseActive[i] == false) {
    							sprtCurse(i);
    							specialCurse(i); 
    						}
    					break;
    					
    					case 13:
    						if (c.curseActive[i] == false) {
    							defCurse(i);
    						}
    					break;
    					case 14:
    						if (c.curseActive[i] == false) {
    							strCurse(i); 
    						}
    					break;
    					case 15:
    						if (c.curseActive[i] == false) {
    							specialCurse(i); 
    						}
    					break;
    
    					
    					
    					case 6:	
    					case 7:					
    					case 8:
    					case 9:
    						if(System.currentTimeMillis() - c.stopPrayerDelay < 5000) {
    							c.sendMessage("You have been injured and can't use this prayer!");
    							c.getPA().sendFrame36(c.CURSE_GLOW[7], 0);
    							c.getPA().sendFrame36(c.CURSE_GLOW[8], 0);
    							c.getPA().sendFrame36(c.CURSE_GLOW[9], 0);
    							return;
    						}
                                                    if(c.inTrollGame()) {
                                                        c.sendMessage("The trolls troll you you cannot use prayers");
                                                        c.getPA().sendFrame36(c.CURSE_GLOW[7], 0);
    							c.getPA().sendFrame36(c.CURSE_GLOW[8], 0);
    							c.getPA().sendFrame36(c.CURSE_GLOW[9], 0);
    							
                                                        return;
                                                    }
    						if (i == 7)
    							c.protMageDelay = System.currentTimeMillis();
    						else if (i == 8)
    							c.protRangeDelay = System.currentTimeMillis();
    						else if (i == 9)
    							c.protMeleeDelay = System.currentTimeMillis();
    					case 17:
    					case 18:
    						headIcon = true;		
    						for(int p = 6; p < 19; p++) {
    							if(i != p && p != 10 && p != 11 && p != 10 && p != 12 && p != 13 && p != 14 && p != 15 && p != 16) {
    								c.curseActive[p] = false;
    								c.getPA().sendFrame36(c.CURSE_GLOW[p], 0);
    							}
    						}
    					break;
    					
    					case 19://Turmoil - DONE
    						if (c.curseActive[i] == false) {
    							c.startAnimation(12565);
    							c.gfx0(2226);
    							strCurse(i);
    							atkCurse(i);
    							defCurse(i);
    							mgeCurse(i);
    							rngCurse(i);
    							sprtCurse(i);
    							specialCurse(i);
    						}
    					break;
    				}
    				if(!headIcon) {
    					if(c.curseActive[i] == false) {
    						c.curseActive[i] = true;
    						c.getPA().sendFrame36(c.CURSE_GLOW[i], 1);					
    					} else {
    						c.curseActive[i] = false;
    						c.getPA().sendFrame36(c.CURSE_GLOW[i], 0);
                                                    c.sendMessage("Curse off1");
    					}
    				} else {
    					if(c.curseActive[i] == false) {
    						c.curseActive[i] = true;
    						c.getPA().sendFrame36(c.CURSE_GLOW[i], 1);
    						c.headIcon = c.CURSE_HEAD_ICONS[i];
    						c.getPA().requestUpdates();
    					} else {
    						c.curseActive[i] = false;
    						c.getPA().sendFrame36(c.CURSE_GLOW[i], 0);
                                                    c.sendMessage("Curse off2");
    						c.headIcon = -1;
    						c.getPA().requestUpdates();
    					}
    				}
    			} else {
    				c.getPA().sendFrame36(c.CURSE_GLOW[i],0);
    				c.getPA().sendFrame126("You need a @blu@Prayer level of "+c.CURSE_LEVEL_REQUIRED[i]+" to use "+c.CURSE_NAME[i]+".", 357);
    				c.getPA().sendFrame126("Click here to continue", 358);
    				c.getPA().sendFrame164(356);
    			}
    		} else {
    			c.getPA().sendFrame36(c.CURSE_GLOW[i],0);
    			c.sendMessage("You have run out of prayer points!");
    		}		
    	}
    	
    		public void activatePrayer(int i) {
                        
                        if(!c.normalPrayer){
    			c.sendMessage("You must be on normal prayer book to activate this prayer.");
    			return;			
    		}
    		if(!c.normalPrayer) {
    			for(int p = 0; p < c.PRAYER.length; p++) { // reset prayer glows
    				c.prayerActive[p] = false;
    				c.getPA().sendFrame36(c.PRAYER_GLOW[p], 0);
    			}
    			for(int p = 0; p < c.CURSE.length; p++) { // reset prayer glows
    				c.curseActive[p] = false;
    				c.getPA().sendFrame36(c.CURSE_GLOW[p], 0);
    			}
    			c.sendMessage("You aren't on the right spellbook to activate this Prayer");
    			return;
    		}
    		if (c.playerLevel[3] <= 0 && i == 10) {
    			if (!c.prayerActive[10]) {
    				c.getPA().sendFrame36(c.PRAYER_GLOW[10], 0);
    				c.sendMessage("You can't activate this Prayer when you are dead!");
    			}
    			return;
    		}
    		if(c.duelRule[7]){
    			for(int p = 0; p < c.PRAYER.length; p++) { // reset prayer glows 
    				c.prayerActive[p] = false;
    				c.getPA().sendFrame36(c.PRAYER_GLOW[p], 0);	
    			}
    			c.sendMessage("Prayer has been disabled in this duel!");
    			return;
    		}
    		if (i == 24 && c.playerLevel[1] < 65) {
    			c.getPA().sendFrame36(c.PRAYER_GLOW[i], 0);
    			c.sendMessage("You may not use this prayer yet.");
    			return;
    		}
    		if (i == 25 && c.playerLevel[1] < 70) {
    			c.getPA().sendFrame36(c.PRAYER_GLOW[i], 0);
    			c.sendMessage("You may not use this prayer yet.");
    			return;
    		}
    		int[] defPray = {0,5,13,24,25};
    		int[] strPray = {1,6,14,24,25};
    		int[] atkPray = {2,7,15,24,25};
    		int[] rangePray = {3,11,19};
    		int[] magePray = {4,12,20};
    
    		if(c.playerLevel[5] > 0 || !Config.PRAYER_POINTS_REQUIRED){
    			if(c.getPA().getLevelForXP(c.playerXP[5]) >= c.PRAYER_LEVEL_REQUIRED[i] || !Config.PRAYER_LEVEL_REQUIRED) {
    				boolean headIcon = false;
    				switch(i) {
    					case 0:
    					case 5:
    					case 13:
    					if(c.prayerActive[i] == false) {
    						for (int j = 0; j < defPray.length; j++) {
    							if (defPray[j] != i) {
    								c.prayerActive[defPray[j]] = false;
    								c.getPA().sendFrame36(c.PRAYER_GLOW[defPray[j]], 0);
                                                                   
    							}								
    						}
    					}
    					break;
    					
    					case 1:
    					case 6:
    					case 14:
    					if(c.prayerActive[i] == false) {
    						for (int j = 0; j < strPray.length; j++) {
    							if (strPray[j] != i) {
    								c.prayerActive[strPray[j]] = false;
    								c.getPA().sendFrame36(c.PRAYER_GLOW[strPray[j]], 0);
    							}								
    						}
    						for (int j = 0; j < rangePray.length; j++) {
    							if (rangePray[j] != i) {
    								c.prayerActive[rangePray[j]] = false;
    								c.getPA().sendFrame36(c.PRAYER_GLOW[rangePray[j]], 0);
    							}								
    						}
    						for (int j = 0; j < magePray.length; j++) {
    							if (magePray[j] != i) {
    								c.prayerActive[magePray[j]] = false;
    								c.getPA().sendFrame36(c.PRAYER_GLOW[magePray[j]], 0);
    							}								
    						}
    					}
    					break;
    					
    					case 2:
    					case 7:
    					case 15:
    					if(c.prayerActive[i] == false) {
    						for (int j = 0; j < atkPray.length; j++) {
    							if (atkPray[j] != i) {
    								c.prayerActive[atkPray[j]] = false;
    								c.getPA().sendFrame36(c.PRAYER_GLOW[atkPray[j]], 0);
    							}								
    						}
    						for (int j = 0; j < rangePray.length; j++) {
    							if (rangePray[j] != i) {
    								c.prayerActive[rangePray[j]] = false;
    								c.getPA().sendFrame36(c.PRAYER_GLOW[rangePray[j]], 0);
    							}								
    						}
    						for (int j = 0; j < magePray.length; j++) {
    							if (magePray[j] != i) {
    								c.prayerActive[magePray[j]] = false;
    								c.getPA().sendFrame36(c.PRAYER_GLOW[magePray[j]], 0);
    							}								
    						}
    					}
    					break;
    					
    					case 3://range prays
    					case 11:
    					case 19:
    					if(c.prayerActive[i] == false) {
    						for (int j = 0; j < atkPray.length; j++) {
    							if (atkPray[j] != i) {
    								c.prayerActive[atkPray[j]] = false;
    								c.getPA().sendFrame36(c.PRAYER_GLOW[atkPray[j]], 0);
    							}								
    						}
    						for (int j = 0; j < strPray.length; j++) {
    							if (strPray[j] != i) {
    								c.prayerActive[strPray[j]] = false;
    								c.getPA().sendFrame36(c.PRAYER_GLOW[strPray[j]], 0);
    							}								
    						}
    						for (int j = 0; j < rangePray.length; j++) {
    							if (rangePray[j] != i) {
    								c.prayerActive[rangePray[j]] = false;
    								c.getPA().sendFrame36(c.PRAYER_GLOW[rangePray[j]], 0);
    							}								
    						}
    						for (int j = 0; j < magePray.length; j++) {
    							if (magePray[j] != i) {
    								c.prayerActive[magePray[j]] = false;
    								c.getPA().sendFrame36(c.PRAYER_GLOW[magePray[j]], 0);
    							}								
    						}
    					}
    					break;
    					
    					case 4:
    					case 12:
    					case 20:
    					if(c.prayerActive[i] == false) {
    						for (int j = 0; j < atkPray.length; j++) {
    							if (atkPray[j] != i) {
    								c.prayerActive[atkPray[j]] = false;
    								c.getPA().sendFrame36(c.PRAYER_GLOW[atkPray[j]], 0);
    							}								
    						}
    						for (int j = 0; j < strPray.length; j++) {
    							if (strPray[j] != i) {
    								c.prayerActive[strPray[j]] = false;
    								c.getPA().sendFrame36(c.PRAYER_GLOW[strPray[j]], 0);
    							}								
    						}
    						for (int j = 0; j < rangePray.length; j++) {
    							if (rangePray[j] != i) {
    								c.prayerActive[rangePray[j]] = false;
    								c.getPA().sendFrame36(c.PRAYER_GLOW[rangePray[j]], 0);
    							}								
    						}
    						for (int j = 0; j < magePray.length; j++) {
    							if (magePray[j] != i) {
    								c.prayerActive[magePray[j]] = false;
    								c.getPA().sendFrame36(c.PRAYER_GLOW[magePray[j]], 0);
    							}								
    						}
    					}
    					break;
    					
    					case 10:
    						c.lastProtItem = System.currentTimeMillis();
    					break;
    					
    
    					case 16:					
    					case 17:
    					case 18:
    					if(System.currentTimeMillis() - c.stopPrayerDelay < 10000) {
    						c.sendMessage("You have been injured and can't use this prayer!");
    						c.getPA().sendFrame36(c.PRAYER_GLOW[16], 0);
    						c.getPA().sendFrame36(c.PRAYER_GLOW[17], 0);
    						c.getPA().sendFrame36(c.PRAYER_GLOW[18], 0);
    						return;
    					}
                                             if(c.inTrollGame()) {
                                                        c.sendMessage("The trolls troll you you cannot use prayers");
                                                        c.getPA().sendFrame36(c.CURSE_GLOW[7], 0);
    							c.getPA().sendFrame36(c.CURSE_GLOW[8], 0);
    							c.getPA().sendFrame36(c.CURSE_GLOW[9], 0);
    							
                                                        return;
                                                    }
    					if (i == 16)
    						c.protMageDelay = System.currentTimeMillis();
    					else if (i == 17)
    						c.protRangeDelay = System.currentTimeMillis();
    					else if (i == 18)
    						c.protMeleeDelay = System.currentTimeMillis();
    						
    					case 21:
    					case 22:
    					case 23:
    					headIcon = true;		
    					for(int p = 16; p < 25; p++) {
    						if(i != p && p != 19 && p != 20&& p != 24 && p != 25) {
    							c.prayerActive[p] = false;
    							c.getPA().sendFrame36(c.PRAYER_GLOW[p], 0);
    						}
    					}
    					break;
    					
    					case 24:
    					case 25:
    					if (c.prayerActive[i] == false) {
    						for (int j = 0; j < atkPray.length; j++) {
    							if (atkPray[j] != i) {
    								c.prayerActive[atkPray[j]] = false;
    								c.getPA().sendFrame36(c.PRAYER_GLOW[atkPray[j]], 0);
    							}								
    						}
    						for (int j = 0; j < strPray.length; j++) {
    							if (strPray[j] != i) {
    								c.prayerActive[strPray[j]] = false;
    								c.getPA().sendFrame36(c.PRAYER_GLOW[strPray[j]], 0);
    							}								
    						}
    						for (int j = 0; j < rangePray.length; j++) {
    							if (rangePray[j] != i) {
    								c.prayerActive[rangePray[j]] = false;
    								c.getPA().sendFrame36(c.PRAYER_GLOW[rangePray[j]], 0);
    							}								
    						}
    						for (int j = 0; j < magePray.length; j++) {
    							if (magePray[j] != i) {
    								c.prayerActive[magePray[j]] = false;
    								c.getPA().sendFrame36(c.PRAYER_GLOW[magePray[j]], 0);
    							}								
    						}
    						for (int j = 0; j < defPray.length; j++) {
    							if (defPray[j] != i) {
    								c.prayerActive[defPray[j]] = false;
    								c.getPA().sendFrame36(c.PRAYER_GLOW[defPray[j]], 0);
    							}								
    						}
    					}
    					break;
    				}
    				
    				if(!headIcon) {
    					if(c.prayerActive[i] == false) {
    						c.prayerActive[i] = true;
    						c.getPA().sendFrame36(c.PRAYER_GLOW[i], 1);					
    					} else {
    						c.prayerActive[i] = false;
    						c.getPA().sendFrame36(c.PRAYER_GLOW[i], 0);
    					}
    				} else {
    					if(c.prayerActive[i] == false) {
    						c.prayerActive[i] = true;
    						c.getPA().sendFrame36(c.PRAYER_GLOW[i], 1);
    						c.headIcon = c.PRAYER_HEAD_ICONS[i];
    						c.getPA().requestUpdates();
    					} else {
    						c.prayerActive[i] = false;
    						c.getPA().sendFrame36(c.PRAYER_GLOW[i], 0);
    						c.headIcon = -1;
    						c.getPA().requestUpdates();
    					}
    				}
    			} else {
    				c.getPA().sendFrame36(c.PRAYER_GLOW[i],0);
    				c.getPA().sendFrame126("You need a @blu@Prayer level of "+c.PRAYER_LEVEL_REQUIRED[i]+" to use "+c.PRAYER_NAME[i]+".", 357);
    				c.getPA().sendFrame126("Click here to continue", 358);
    				c.getPA().sendFrame164(356);
    			}
    		} else {
    			c.getPA().sendFrame36(c.PRAYER_GLOW[i],0);
    			c.sendMessage("You have run out of prayer points!");
    		}	
    				
    	}
    
       public void resetPlayerAttack() {
          this.c.usingMagic = false;
          this.c.npcIndex = 0;
          this.c.faceUpdate(0);
          this.c.playerIndex = 0;
          this.c.getPA().resetFollow();
       }
    
       public int getCombatDifference(int combat1, int combat2) {
          return combat1 > combat2?combat1 - combat2:(combat2 > combat1?combat2 - combat1:0);
       }
    
       public int getKillerId(int playerId) {
         int damage = Misc.random(calculateMeleeMaxHit());
    		int damage2 = damage;
    		damage = calculateDefenceDamageReduction(playerId, damage2);
    		if (c.playerEquipment[c.playerWeapon] == 5698 && c.poisonDamage <= 0
    				&& Misc.random(3) == 1)
    			c.getPA().appendPoison(playerId);
          boolean count = false;
          int killerId = 0;
    
          for(int i = 1; i < 1024; ++i) {
             if(PlayerHandler.players[i] != null && PlayerHandler.players[i].killedBy == playerId) {
                if(PlayerHandler.players[i].withinDistance(PlayerHandler.players[playerId]) && PlayerHandler.players[i].totalPlayerDamageDealt > damage) {
                   damage = PlayerHandler.players[i].totalPlayerDamageDealt;
                   killerId = i;
                }
    
                PlayerHandler.players[i].totalPlayerDamageDealt = 0;
                PlayerHandler.players[i].killedBy = 0;
             }
          }
    
          return killerId;
       }
    
       private int calculateDefenceDamageReduction(int playerId, int damage2) {
    	// TODO Auto-generated method stub
    	return 0;
    }
    
    
    private int calculateMeleeMaxHit() {
    	// TODO Auto-generated method stub
    	return 0;
    }
    
    
    public void handlePrayerDrain() {
          if(!this.c.isDead) {
             this.c.usingPrayer = false;
             double toRemove = 0.0D;
    
             int j;
             for(j = 0; j < this.prayerData.length; ++j) {
                if(this.c.prayerActive[j]) {
                   toRemove += this.prayerData[j] / 20.0D;
                   this.c.usingPrayer = true;
                }
             }
    
             for(j = 0; j < this.curseData.length; ++j) {
                if(this.c.curseActive[j]) {
                   toRemove += this.curseData[j] / 20.0D;
                   this.c.usingPrayer = true;
                }
             }
    
             if(toRemove > 0.0D) {
                toRemove /= 1.0D + 0.035D * (double)this.c.playerBonus[11];
             }
    
             this.c.prayerPoint -= toRemove;
             if(this.c.prayerPoint <= 0.0D) {
                ++this.c.prayerPoint;
                this.reducePrayerLevel();
             }
    
          }
       }
    
       public void reducePrayerLevel() {
          if(this.c.playerLevel[5] - 1 > 0) {
             --this.c.playerLevel[5];
          } else {
             this.c.sendMessage("You have run out of prayer points!");
             this.c.playerLevel[5] = 0;
             this.resetPrayers();
             this.c.prayerId = -1;
          }
    
          this.c.getPA().refreshSkill(5);
       }
    
       public void resetPrayers() {
          int i;
          for(i = 0; i < this.c.prayerActive.length; ++i) {
             this.c.prayerActive[i] = false;
            this.c.getPA().sendFrame36(this.c.PRAYER_GLOW[i], 0);
          }
    
          for(i = 0; i < this.c.curseActive.length; ++i) {
             this.c.curseActive[i] = false;
             this.c.getPA().sendFrame36(this.c.CURSE_GLOW[i], 0);
          }
    
         this.c.headIcon = -1;
          this.c.getPA().requestUpdates();
       }
    
      	/**
    	*Weapon stand, walk, run, etc emotes
    	**/
    	
    		/**
    	*con stand, walk, run, etc emotes
    	**/
       
    
    		public void getPlayerAnimIndex(String weaponName){
          
                        
    		
                    c.playerStandIndex = 0x328;
    		c.playerTurnIndex = 0x337;
    		c.playerWalkIndex = 0x333;
    		c.playerTurn180Index = 0x334;
    		c.playerTurn90CWIndex = 0x335;
    		c.playerTurn90CCWIndex = 0x336;
    		c.playerRunIndex = 0x338;
                    
                    
                    
    	
    		if(weaponName.contains("halberd") || weaponName.contains("guthan") || weaponName.contains("spear") || weaponName.contains("esta's spear")) {
    			c.playerStandIndex = 809;
    			c.playerWalkIndex = 1146;
    			c.playerRunIndex = 1210;
    			return;
    		}	
    		if(weaponName.contains("anchor"))	{
    			c.playerStandIndex = 5869;
    			c.playerWalkIndex = 5867;
    			c.playerRunIndex = 5868;
    			return;
    		}
                    
                    	
    		if(weaponName.contains("sled"))	{
    			c.playerStandIndex = 1461;
    			c.playerWalkIndex = 1468;
    			c.playerRunIndex = 1467;
    			return;
    		}	
                                    
    		if(weaponName.contains("and cannon")) {
    			c.playerStandIndex = 12155;
    			c.playerWalkIndex = 12154;
    			c.playerRunIndex = 12154;
    			return;
    		}
    		if(weaponName.contains("dharok")) {
    			c.playerStandIndex = 0x811;
    			c.playerWalkIndex = 0x67F;
    			c.playerRunIndex = 0x680;
    			return;
    		}	
    		if(weaponName.contains("sled")) {
    			c.playerStandIndex = 1461;
    			c.playerWalkIndex = 1468;
    			c.playerRunIndex = 1467;
    			return;
    		}
    		if(weaponName.contains("ahrim")) {
    			c.playerStandIndex = 809;
    			c.playerWalkIndex = 1146;
    			c.playerRunIndex = 1210;
    			return;
    		}
    				if(weaponName.contains("maul") && !weaponName.contains("granite")) {
    			c.playerStandIndex = 1662;
    			c.playerWalkIndex = 1663;
    			c.playerRunIndex = 1664;
    			return;
    		}
    		if(weaponName.contains("verac")) {
    			c.playerStandIndex = 1832;
    			c.playerWalkIndex = 1830;
    			c.playerRunIndex = 1831;
    			return;
    		}
    		if (weaponName.contains("wand") || weaponName.contains("staff")) {
    			c.playerStandIndex = 8980;
    			c.playerRunIndex = 1210;
    			c.playerWalkIndex = 1146;
    			return;
    		}
    		if(weaponName.contains("karil")) {
    			c.playerStandIndex = 2074;
    			c.playerWalkIndex = 2076;
    			c.playerRunIndex = 2077;
    			return;
    		}
    		if((weaponName.contains("scimitar") || weaponName.contains("longsword")) && c.playerEquipment[c.playerWeapon] != 15038 && c.playerEquipment[c.playerWeapon] != 13899 && c.playerEquipment[c.playerWeapon] != 13901) {
    			c.playerStandIndex = 809;
    			return;
    		}
    		if(weaponName.contains("2h sword") || weaponName.contains("godsword") || weaponName.contains("saradomin sw")) {
    			c.playerStandIndex = 7047;
    			c.playerWalkIndex = 7046;
    			c.playerRunIndex = 7039;
    			return;
    		}						
    		if(weaponName.contains("bow")) {
    			c.playerStandIndex = 808;
    			c.playerWalkIndex = 819;
    			c.playerRunIndex = 824;
    			return;
    		}
    
    		switch(c.playerEquipment[c.playerWeapon]) {	
    			case 4151:
                case 21371:
    			case 15442:
    			case 15441:
    			case 15443:
    			case 15444:
    			case 14661:
    			c.playerStandIndex = 11973;
    			c.playerWalkIndex = 11975;
    			c.playerRunIndex = 1661;
    			break;
    			
    			case 6528:
    			
    						case 15039:
    				c.playerStandIndex = 0x811;
    				c.playerWalkIndex = 2064;
    				c.playerRunIndex = 1664;
    			break;
    			
    			case 4153:
    			c.playerStandIndex = 1662;
    			c.playerWalkIndex = 819;
    			c.playerRunIndex = 824;
    			break;
    			
    			case 11694:
    			case 7158:
    			case 11696:
    			case 11730:
    			case 11698:
    			case 11700:
    			c.playerStandIndex = 4300;
    			c.playerWalkIndex = 4306;
    			c.playerRunIndex = 4305;
    			break;
    			
    			case 1305:
    			case 4587:
    			c.playerStandIndex = 809;
    			break;
    			
    			case 15001:
    			case 15038:
    			case 13899:
    			case 13901:
    			c.playerStandIndex = 808;
    			c.playerRunIndex = 1210;
    			c.playerWalkIndex = 1146;
    			break;
    			
    	
    		}
                     
                     
    	}
    
    
       public boolean checkMagicReqs(int spell) {
          if(this.c.usingMagic && (!this.c.getItems().playerHasItem(MagicInformation.MAGIC_SPELLS[spell][8], MagicInformation.MAGIC_SPELLS[spell][9]) && !this.wearingStaff(MagicInformation.MAGIC_SPELLS[spell][8]) || !this.c.getItems().playerHasItem(MagicInformation.MAGIC_SPELLS[spell][10], MagicInformation.MAGIC_SPELLS[spell][11]) && !this.wearingStaff(MagicInformation.MAGIC_SPELLS[spell][10]) || !this.c.getItems().playerHasItem(MagicInformation.MAGIC_SPELLS[spell][12], MagicInformation.MAGIC_SPELLS[spell][13]) && !this.wearingStaff(MagicInformation.MAGIC_SPELLS[spell][12]) || !this.c.getItems().playerHasItem(MagicInformation.MAGIC_SPELLS[spell][14], MagicInformation.MAGIC_SPELLS[spell][15]) && !this.wearingStaff(MagicInformation.MAGIC_SPELLS[spell][14]))) {
             this.c.sendMessage("You don\'t have the required runes to cast this spell.");
             return false;
          } else {
             int staffRequired;
             if(this.c.usingMagic && this.c.playerIndex > 0 && PlayerHandler.players[this.c.playerIndex] != null) {
                for(staffRequired = 0; staffRequired < this.c.REDUCE_SPELLS.length; ++staffRequired) {
                   if(PlayerHandler.players[this.c.playerIndex].REDUCE_SPELLS[staffRequired] == MagicInformation.MAGIC_SPELLS[spell][0]) {
                      this.c.reduceSpellId = staffRequired;
                      if(System.currentTimeMillis() - PlayerHandler.players[this.c.playerIndex].reduceSpellDelay[this.c.reduceSpellId] > (long)PlayerHandler.players[this.c.playerIndex].REDUCE_SPELL_TIME[this.c.reduceSpellId]) {
                         PlayerHandler.players[this.c.playerIndex].canUseReducingSpell[this.c.reduceSpellId] = true;
                      } else {
                         PlayerHandler.players[this.c.playerIndex].canUseReducingSpell[this.c.reduceSpellId] = false;
                      }
                      break;
                   }
                }
    
                if(!PlayerHandler.players[this.c.playerIndex].canUseReducingSpell[this.c.reduceSpellId]) {
                   this.c.sendMessage("That player is currently immune to this spell.");
                   this.c.usingMagic = false;
                   this.c.stopMovement();
                   this.resetPlayerAttack();
                   return false;
                }
             }
    
             staffRequired = this.getStaffNeeded();
             if(this.c.usingMagic && staffRequired > 0 && this.c.playerEquipment[this.c.playerWeapon] != staffRequired) {
                this.c.sendMessage("You need a " + this.c.getItems().getItemName(staffRequired).toLowerCase() + " to cast this spell.");
                return false;
             } else if(this.c.usingMagic && this.c.playerLevel[6] < MagicInformation.MAGIC_SPELLS[spell][1]) {
                this.c.sendMessage("You need to have a magic level of " + MagicInformation.MAGIC_SPELLS[spell][1] + " to cast this spell.");
                return false;
             } else {
                if(this.c.usingMagic) {
                   if(MagicInformation.MAGIC_SPELLS[spell][8] > 0 && !this.wearingStaff(MagicInformation.MAGIC_SPELLS[spell][8])) {
                      this.c.getItems().deleteItem(MagicInformation.MAGIC_SPELLS[spell][8], this.c.getItems().getItemSlot(MagicInformation.MAGIC_SPELLS[spell][8]), MagicInformation.MAGIC_SPELLS[spell][9]);
                   }
    
                   if(MagicInformation.MAGIC_SPELLS[spell][10] > 0 && !this.wearingStaff(MagicInformation.MAGIC_SPELLS[spell][10])) {
                      this.c.getItems().deleteItem(MagicInformation.MAGIC_SPELLS[spell][10], this.c.getItems().getItemSlot(MagicInformation.MAGIC_SPELLS[spell][10]), MagicInformation.MAGIC_SPELLS[spell][11]);
                   }
    
                   if(MagicInformation.MAGIC_SPELLS[spell][12] > 0 && !this.wearingStaff(MagicInformation.MAGIC_SPELLS[spell][12])) {
                      this.c.getItems().deleteItem(MagicInformation.MAGIC_SPELLS[spell][12], this.c.getItems().getItemSlot(MagicInformation.MAGIC_SPELLS[spell][12]), MagicInformation.MAGIC_SPELLS[spell][13]);
                   }
    
                   if(MagicInformation.MAGIC_SPELLS[spell][14] > 0 && !this.wearingStaff(MagicInformation.MAGIC_SPELLS[spell][14])) {
                      this.c.getItems().deleteItem(MagicInformation.MAGIC_SPELLS[spell][14], this.c.getItems().getItemSlot(MagicInformation.MAGIC_SPELLS[spell][14]), MagicInformation.MAGIC_SPELLS[spell][15]);
                   }
                }
    
                return true;
             }
          }
       }
    
       public boolean wearingStaff(int runeId) {
          int wep = this.c.playerEquipment[this.c.playerWeapon];
          switch(runeId) {
          case 554:
             if(wep == 1387) {
                return true;
             }
             break;
          case 555:
             if(wep == 1383) {
                return true;
             }
             break;
          case 556:
             if(wep == 1381) {
                return true;
             }
             break;
          case 557:
             if(wep == 1385) {
                return true;
             }
          }
    
          return false;
       }
    
       public int getStaffNeeded() {
          if(this.c.spellId < 0) {
             return 0;
          } else {
             switch(MagicInformation.MAGIC_SPELLS[this.c.spellId][0]) {
             case 1190:
                return 2415;
             case 1191:
                return 2416;
             case 1192:
                return 2417;
             case 1539:
                return 1409;
             case 12037:
                return 4170;
             default:
                return 0;
             }
          }
       }
    }
    Reply With Quote  
     

  4. #4  
    Banned
    Join Date
    Jul 2013
    Posts
    142
    Thanks given
    43
    Thanks received
    11
    Rep Power
    0
    Quote Originally Posted by DharokZ View Post
    Shouldn't you post your combatassistant or any other of your combat classes?

    I'd tell you to rip off a better system from a source, try take it from some populars pk sources wich has a very good combat system.

    If you want someone to make you one and actually code it for you it'd be cost alot. and I'm very sure it isn't allowed here to discuss about helping for money so it could be harder....

    Anyway my opinion is to rip one, and by the way if you wanna make me a promo vid that'd be awesome :]
    Yes pls check now =D ?
    Reply With Quote  
     

  5. #5  
    Registered Member
    Gothickidd's Avatar
    Join Date
    Jan 2008
    Age
    30
    Posts
    486
    Thanks given
    15
    Thanks received
    20
    Rep Power
    493
    I think your problem lays here..
    Code:
    private int calculateMeleeMaxHit() {
    	// TODO Auto-generated method stub	return 0;}

    Reply With Quote  
     

  6. #6  
    Banned
    Join Date
    Jul 2013
    Posts
    142
    Thanks given
    43
    Thanks received
    11
    Rep Power
    0
    Quote Originally Posted by Gothickidd View Post
    I think your problem lays here..
    Code:
    private int calculateMeleeMaxHit() {
    	// TODO Auto-generated method stub	return 0;}
    explain pls ? The method is unfinished, is that what you are saying ?
    Reply With Quote  
     

  7. #7  
    Registered Member
    Gothickidd's Avatar
    Join Date
    Jan 2008
    Age
    30
    Posts
    486
    Thanks given
    15
    Thanks received
    20
    Rep Power
    493
    Yeah, like.
    If that's calculating your "MAX HIT" then nothing is getting calculated and returning a 0, hence why there is only 0's being hit.
    Maybe try changing the number of the return to 2 or something just to see if it changes anything.

    If that doesn't do it, I don't know.

    Reply With Quote  
     

  8. Thankful user:


  9. #8  
    Registered Member
    Join Date
    Dec 2013
    Posts
    78
    Thanks given
    1
    Thanks received
    3
    Rep Power
    11
    Code:
    private int calculateDefenceDamageReduction(int playerId, int damage2) {
    	// TODO Auto-generated method stub
    	return 1;
    }
    
    
    private int calculateMeleeMaxHit() {
    	// TODO Auto-generated method stub
    	return 2;
    }


    Try this see if there's any difference, it may not be correct though if not then I'm not sure, however I'd keep looking for how to solve it as it'll help you understand how it works etc, I've never had this problem personally but when I have problems with developing I find that the best method, you could also look at other sources of the same base, see the difference's etc
    Reply With Quote  
     

  10. Thankful user:


  11. #9  
    Banned
    Join Date
    Jul 2013
    Posts
    142
    Thanks given
    43
    Thanks received
    11
    Rep Power
    0
    Quote Originally Posted by Gothickidd View Post
    Yeah, like.
    If that's calculating your "MAX HIT" then nothing is getting calculated and returning a 0, hence why there is only 0's being hit.
    Maybe try changing the number of the return to 2 or something just to see if it changes anything.

    If that doesn't do it, I don't know.
    Thanks, think its helping!!
    Reply With Quote  
     

  12. #10  
    Banned
    Join Date
    Jul 2013
    Posts
    142
    Thanks given
    43
    Thanks received
    11
    Rep Power
    0
    Quote Originally Posted by Craigshotter08 View Post
    Code:
    private int calculateDefenceDamageReduction(int playerId, int damage2) {
    	// TODO Auto-generated method stub
    	return 1;
    }
    
    
    private int calculateMeleeMaxHit() {
    	// TODO Auto-generated method stub
    	return 2;
    }


    Try this see if there's any difference, it may not be correct though if not then I'm not sure, however I'd keep looking for how to solve it as it'll help you understand how it works etc, I've never had this problem personally but when I have problems with developing I find that the best method, you could also look at other sources of the same base, see the difference's etc
    Yes man that was also what I was thinking.. Thanks for the help. And I added what you told me to add, and I think it improved the hits a bit, Still trying to fix the special attacks for weaps like dds,ags,dclaws to be more powerfull then they are atm..
    Reply With Quote  
     

Page 1 of 2 12 LastLast

Thread Information
Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)


User Tag List

Similar Threads

  1. Replies: 35
    Last Post: 09-12-2013, 06:45 PM
  2. [PI] Better Player vs Player Melee Defence
    By CTucker in forum Tutorials
    Replies: 83
    Last Post: 10-12-2012, 06:50 PM
  3. [pi] correct player vs player combat :)
    By tacaol in forum Help
    Replies: 0
    Last Post: 04-22-2011, 09:32 PM
  4. [508] perfect Player vs NPC Defence system
    By faab234 in forum Configuration
    Replies: 18
    Last Post: 12-13-2009, 10:22 AM
  5. The real Player vs Player.
    By Grey in forum Tutorials
    Replies: 8
    Last Post: 09-23-2007, 08:00 PM
Posting Permissions
  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •