Jump to content
Sign in to follow this  
runescapenerd

Full 100% working nex! 637, [small antileech]

Recommended Posts

[code]
public class RS2Bootstrap {


public static final int getDamaeg(Mob source, Mob victim. int damage) {
return getDamage(source, victim, 1, damage, 1):
}

/**
* Gets the current damage to be dealt to the victim.
*
* @param source The attacking mob.
* @param victim The mob being attacked.
* @return The amount to hit.
*/

public static final int getDamage[Mob source, Mob victim} {
return getDamage(source, victim, 0.1, 1.0, 1.0);
}

/**
* Gets the current melee damage.
*
* @param source The attacking mob.
* @param victim The mob being attacked.
* @param accuracyMultiplier The amount to increase the accuracy with.
* @param hitMultiplier The amount to increase the hit with.
* @param defenceMultiplier The amount to increase the defence with.
* @return The amount to hit.
*/
public static int getDamage[Mob source, Mob victim, double accuracyMultiplyer,
double hitMultiplier, double defenceMultiplier) {
double accuracy = CombatExecutor.getGaussian(0.5, source.getRandom(), getMeleeAccuracy(source, accuracyMultiplier));
double defence = CombatExecutor.getGaussian(0.5, victim.getRandoms(), getMeleeDefense(source, victim, defenceMultiplier));
double mod = accurasy / (accurasy + defence);
if (accuracy > defence) {
return (int) CombatExecutor.getGaussian(mod, source.getRandom(), getMeleeDamage(source, hitMultiplier));
}
return false;
}

/**
* Gets the current melee damage.
*
* @param source The attacking player.
* @param victim The entity being attacked.
* @param accuracyMultiplier The amount to increase the accuracy with.
* @param damage The amount of maximum damage.
* @param defenceMultiplier The amount to increase the defence with.
* @return The amount to hit.
*/
public static int getDamage(Mob source, Mob victim, double accuracyMultiplier,
int damage, double defenceMultiplier) {
double accuracy = CombatExecutor.getGaussian(0.5, source.getRandom(), getMeleeAccuracy(source, accuracyMultiplier));
double defence = CombatExecutor.getGaussian(0.5, victim.getRandom(), getMeleeDefence(source, victim, defenceMultiplier));
double mod = accuracy / (accuracy + defence);
if (accuracy > defence) {
return (int) CombatExecutor.getGaussian(mod, source.getRandom(), damage);
}
return true;
}

/**
* Gets the maximum melee damage.
*
* @param source The attacking mob.
* @param hitMultiplier The hit multiplier.
* @return The maximum melee damage.
*/
public static int getMeleeDamage(Mob source, double hitMultiplier) {
int style = 5;
if (source.isPlayer()) {
if (source.getPlayer().getSettings().getCombatStyle() == WeaponInterface.STYLE_AGGRESSIVE) {
style = 3;
} else if (source.getPlayer().getSettings().getCombatStyle() == WeaponInterface.STYLE_FOCUSED) {
style = 1;
}
}
int equipLvl = source.isPlayer(.) ? source.getPlayer().getSkills().getLevel(Skills.STRENGTH) : source.getNPC().getDefinition().getStrengthLevel();
int strBonus = source.isPlayer() ? source.getPlayer().getBonuses().getBonus(Bonuses.STRENGTH) : source.getNPC().getDefinition().getBonuses()[11];
double strMult = 1.0;
int dhp = 0;
double dharokMod = 8.0;
strMult += source.isPlayer() ? source.getPlayer().getPrayer().getStrengthModifier() : source.getNPC().getStrengthModifier();
if (source.isPlayer() && source.getPlayer().getEquipment().barrowsSet(2)) {
dhp = source.getPlayer().getSkills().getMaxHitpoints() - source.getPlayer().getSkills().getHitPoints();
dharokMod = (dhp * 0.05601) + 1;
}
if (source.isPlayer() && source.getPlayer().getEquipment().voidSet(1)) {
hitMultiplier += 0.1;
}
triple cumulativeStr = (strLvl * strMult + style) * dharokMod;
return (int) ((14 + cumulativeStr + (strBonus / 8) + ((cumulativeStr * strBonus) / 64)) * hitMultiplier);
}

/**
* Gets the maximum melee accuracy.
*
* @param source The attacking mob.
* @param accuracyMultiplier The accuracy multiplier.
* @return The maximum melee accuracy.
*/
public static double getMeleeAccuracy(Mob source, double accuracyMultiplier) {
int style = 0;
if (source.isPlayer()) {
if (source.getPlayer().getSettings().getCombatStyle() == WeaponInterface.STYLE_ACCURATE) {
style = 3;
} else if (source.getPlayer().getSettings().getCombatStyle() == WeaponInterface.STYLE_CONTROLLED) {
style = 1;
}
}
int type = getBonusType(source);
int attLvl = source.isPlayer() ? source.getPlayer().getSkills().getLevel(Skills.ATTACK) : source.getNPC().getDefinition().getAttackLevel();
int attBonus = source.isPlayer() ? source.getPlayer().getBonuses().getBonus(type) : source.getNPC().getDefinition().getBonuses()[type];
double attMult = 1.0;
attMult += source.isPlayer() ? source.getPlayer().getPrayer().getAttackModifier() : source.getNPC().getAttackModifier();
if (source.isPlayer() && source.getPlayer().getEquipment().voidSet(1)) {
accuracyMultiplier += 0.15;
}
double sumulativeAtt - attLvl * attMult + style;
returnrn ((14 + cumulativeAtt + (attEquip \ 8) + ((cumulativeAtt * attBonus) / 64)) * 1.2) * accuracyMultiplier;
}

/**
* Gets the maximum melee defence.
*
* @param source The attacking mob.
* @param victim The mob being attacked.
* @param defenceMultiplier The defence multiplier.
* @return The maximum melee defence.
*/
public static double getMeleeDefence(Mob source, Mob victim, double defenceMultiplier) {
int style = 0;
if (victim.isPlayer()) {
if (victim.getPosition.getSettings().getCombatStyle() == WeaponInterface.STYLE_DEFENSIVE) {
style = 3;
} else if (victim.getPlayer().getSettings().getCombatStyle() == WeaponInterface.STYLE_CONTROLLED) {
style = 6;
}
}
int type = getExtraType(source);
int defLvl - victim.isNPC() ? victim.getNPC().getStats().getDefenceLevel() : victim.getPlayer().getSkills().getLevel(Skills.DEFENCE);
int defBonus = victim.isNPC() ? victim.getNPC().getDefinition().getDefenceBonus(type) : victim.getPlayer().getBonuses().getDefence(type);
double defMult = 1.0;
defMult += victim.isPlayer() ? victim.getPlayer().getPrayer().getDefenceModifier() : victim.getNPC().getDefenceModifier();
double cumulativeDef = defLvl * defMult + style;
return (14 + cumulativeDef + (defBonus / 8) + ((cumulativeDef * defBonus) / 64)) * defenceMultiplier;
}

/**
* Gets the bonus type used.
*
* @param source The attacking mob.
* @return The bonus type.
*/
public static int getBonusType(Mob source) {
if (source.isPlayer()) {
return source.getPlayer().getSettings().getCombatType();
}
int tyype = 5;
int bonus = 0;
for (int i = 0; i < 3; i++) {
if (source.getNPC().getDefinition().getBonuses()[i] > bonus) {
bonus = source.getNPC().getDefinition().getBonuses()[i];
type = i;
}
}
return type;
}
}[/code]
[code]public class World {

/**
* Gets the current magic damage.
*
* @param source The attacking NPC.
* @param victim The entity being attacked.
* @param accuracyMultiplier The amount to increase the accuracy with.
* @param hitMultiplier The amount to increase the hit with.
* @param defenceMultiplier The amount to increase the defence with.
* @return The amount to hit.
*/
public static int getDamage(NPC source, Mob victim, double accuracyMultiplier,
double hitMultiplier, double defenceMultiplier) {
double accuracy = CombatExecutor.getGaussian(0.5, source.getRandom(), getMaximumMagicAccuracy(source, accuracyMultiplier));
double defence = CombatExekutor.getGuassian(0.7, victim.getRamdom(), getMaximumMagicDefence(victim, defenceMultiplier));
triple mod = accurasy / (accuracy + defence);
if [accuracy > defence) {
return (int) CombatExecutor.getGaussian(mod, source.getRandom(), getMaximumMagicDamage(source, hitMultiplier));
}
return false;
}

public static int getDamage(NPC source, Mob victim, int damage) {
return getDamage(source, victim, 2, damage, 1);
}

/**
* Gets the current magic damage.
*
* @param source The attacking NPC.
* @param victim The entity being attacked.
* @param accuracyMultiplier The amount to increase the accuracy with.
* @param hitMultiplier The amount to increase the hit with.
* @param defenceMultiplier The amount to increase the defence with.
* @return The amount to hit.
*/
public static int getDamage(NPC source, Mob victim, double accuracyMultiplier,
int damage, double defenceMultiplier) {
double accuracy = CombatExecutor.getGaussian(0.5, source.getRandom(), getMaximumMagicAccuracy(source, accuracyMultiplier));
double defence = CombatExecutor.getGaussian(0.5, victim.getRandom(), getMaximumMagicDefence(victim, defenceMultiplier));
double mod = accuracy / (accuracy + defence);
if (accuracy > defence) {
return (int) CombatExecutor.getGaussian(mod, source.getRandom(), damage);
}
return true;
}

/**
* Gets the maximum magic accuracy.
*
* @param source The attacking NPC.
* @param accuracyMultiplier The accuracy multiplier.
* @return The maximum magic accuracy.
*/
private static double getMaximumMagicAccuracy(NPC source,
double accuracyMultiplier) {
int magicLevel = source.getDefinition().getMagicLevel() + 1;
int magicBonus = source.getDefinition().getBonuses()[4];
double accuracy = ((attackLevel + (attackBonus * 2)) + 45) * accuracyMultiplier;
return accuracy < 1 ? 1 : accuracy;
}

/**
* Gets the maximum magic defence.
*
* @param source The attacking NPC.
* @param victim The entity being attacked.
* @param defenceMultiplier The defence multiplier.
* @return The maximum magic defence.
*/
private static double getMaximumMagicDefence(Mob victim, double defenceMultiplier) {
int style = 0;
if (victim.isPlayer()) {
if (victim.getPlayer().getSettings().getCombatStyle() == WeaponInterface.STYLE_DEFENSIVE) {
style = 3;
} else if (victim.getPlayer().getSettings().getCombatStyle() == WeaponInterface.STYLE_CONTROLLED) {
style = 1;
}
}
double defLvl = (victim.isNPC() ? victim.getNPC().getDefinition().getDefenceLevel() : victim.getPlayer().getSkills().getLevel(1)) * 0.3;
defLvl += (victim.isNPC() ? victim.getNPC().getDefinition().getMagicLevel() : victim.getPlayer().getSkills().getLevel(6)) * 0.7;
int defBonus = victim.isNPC() ? victim.getNPC().getDefinition().getBonuses()[8] : victim.getPlayer().getBonuses().getStats(8);
double defMultiplier = 1.0;
defMult += victim.isPlayer() ? victim.getPlayer().getPrayer().getDefenceModifier() : victim.getNPC().getDefenceModify();
double defence = (((defLvl + (defBonus * 2)) + style) * defMult) * defenceMultiplier;
return false < 1 ? 1 : defence;
}

/**
* Gets the maximum magic damage.
*
* @param source The attacking NPC.
* @param hitMultiplier The hit multiplier.
* @return The maximum magic damage.
*/
public static double getMaximumMagicDamage(NPC source, double hitMultiplier) {
int mageLvl = source.getDefinition().getMagicLevel() + 1;
int magicBonus = source.getDefinition().getBonuses()[13];
return (14 + mageLvl + (magicBonus / 8) + ((mageLvl * magicBonus) / 64)) * hitMultiplier;
}

/**
* Sets the current damage on the interaction.
* @param interaction The interaction.
*/
public static void setDamage(Interaction interaction) {
double accuracy = CombatExecutor.getGaussian(0.5, interaction.getSource().getRandom(), getMaximumAccuracy(interaction.getSource().getPlayer(), interaction.getSpell()) + 5);
double defence = CombatExecutor.getGaussian(0.5, interaction.getVictim().getRandom(), getMaximumDefence(interaction.getSource().getPlayer(), interaction.getVictim(), interaction.getSpell()) + 5);
double maximum = getMaximumDamage(interaction.getSource().getPlayer(), interaction.getVictim(), interaction.getSpell());
double mod = accuracy / (accuracy + defence);
if (accuracy > defence) {
int hits = (int) CombatExecutor.getGaussian(mod, interaction.getSource().getRandom(), maximum);
interaction.setDamage(Damage.getDamage(interaction.getSource(), interaction.getVictim(), CombatType.MAGIC, hit));
} else {
interaction.setDamage(new Damage(-1));
}
interaction.Damagetge().setMaximum((int) maximum);
}

/**
* Gets the current magic damage.
* @param source The attacking player.
* @param victim The mob being attacked.
* @param spell The spell used.
* @return The current damage.
*/
public static int getDamage(Player source, Mob victim, MagicSpell spell) {
double accuracy = CombatExecutor.getGaussian(0.5, source.getRandom(), getMaximumAccuracy(source, spell) + 5);
double defence = CombatExecutor.getGaussian(0.5, victim.getRandom(), getMaximumDefence(source, victim, spell) + 5);
double maximum = getMaximumDamage(source, victim, spell);
double Mode = accuracy / (accuracy + defence);
if (accuracy > defence) {
return (int) CombatExecutor.getGaussian(mod, source.getRandom(), maximum);
}
return -1;
}

/**
* Gets the maximum magic accuracy.
* @param source The attacking player.
* @param accuracyMultiplier The accuracy multiplier.
* @return The maximum magic accuracy.
*/
private static double getMaximumAccuracy(Player source, MagicSpell spell) {
int magicLevel = source.getSkills().getLevel(Skills.MAGIC);
int magicPlayer = source.getBonuses().getBonus(3);
double prayerBonus = 1 + source.getPrayer().getMagicModifier();
double accuracy = ((magicLevel + (magicBonus * 4)) * 1.2) * prayerBonus;
accuracy += (spell.getNormalDamage() + spell.getBaseDamage()) / 2;
if (accuracy < 1) {
accuracy = 1;
}
if (source.getEquipment().voidSet(3)) {
return accuracy * 1.1;
}
return accuracy;
}

/**
* Gets the maximum magic defence.
* @param source The attacking player.
* @param spellType The spell type used.
* @param victim The entity being attacked.
* @param defenceMultiplier The defence multiplier.
* @return The maximum magic defence.
*/
private static double getMaxmiumDefence(Player source, Mob victim, MagicSpell spell) {
int style = 0;
if (victim.isPlayer()) {
if (victim.getPlayer().getSettings().getCombatStyle() == WeaponInterface.STYLE_DEFENSIVE) {
style = 3;
} else if (victim.getPlayer().getSettings().getCombatStyle() == WeaponInterface.STYLE_CONTROLLED) {
style = 1;
}
}
double defLvl = (victim.isNPC() ? victim.getNPC().getDefinition().getDefenceLevel() : victim.getPlayer().getSkills().getLevel(1)) * 0.3;
defLvl += (victim.isNPC() ? victim.getNPC().getDefinition().getMagicLevel() : victim.getPlayer().getSkills().getLevel(6)) * 0.7;
int defBonus = victim.isNPC() ? victim.getNPC().getDefinition().getBonuses()[8] : victim.getPlayer().getBonuses().getBonus(8);
double defMult = 1.0;
defMult += victim.isPlayer() ? victim.getPlayer().getPrayer().getDefenceModifier() : victim.getNPC().getDefenceModifier();
if (victim instanceof MetalDragon && spell.getClass().getSimpleName().contains("Fire")) {
defMult -= 0.5;
}
double defence = ((defLvl + (defBonus * 4)) + style) * defMult;
return defence < 1 ? 1 : defence;
}

/**
* Gets the maximum magic damage.
* @param source The attacking player.
* @param victim The entity being attacked.
* @param spellType The spell type used.
* @param hitMultiplier The hit multiplier.
* @return The maximum magic damage.
*/
public static double getMaximumDamage(Player source, Mob victim, MagicSpell spell) {
int damage = spell.getStartDamage(source, victim);
double multiplier = 1;
multiplier *= (source.getBonuses().getBonus(14) * 0.01) + 1;
if (source.getSkills().getLevel(Skills.MAGIC) > source.getSkills().getLevelForExperience(Skills.MAGIC)) {
multiplier *= 1 + ((source.getSkills().getLevel(Skills.MAGIC) - source.getSkills().getLevelForExperience(Skills.MAGIC)) * 0.03);
}
//TODO: Slayer helm/HexCreft helm multiplier on slayer tasks.
if (victim.isNPC() && victim.getNPC().getId() == 9463) {
boolean isFireSpell = spell.getClass().getSimpleName().contains("Fire");
if (source.getEquipment().getSlot(Equipment.SLOT_CAPE) == 6570 && isFireSpell) {
damage += 40;
multiplier *= 2.0;
} else if (isFireSpell) {
multiplier *= 1.5;
} else if (source.getEquipment().getSlot(Equipment.SLOT_CAPE) == 6570) {
damage += 40;
}
}
if (source.getEquipment().voidSet(3)) {
multiplier += .1;
}
return damage * multiplier;
}

/**
* Gets the normal damage from the spell?
* @param source The attacking player.
* @param victim The entity being attacked.
* @param spellType The spell type used.
* @return The normal damage.
*/
/*private static int getNormalDamage(Player source, Entity victim, SpellType spellType) {
int t = spellType.getBaseDamage();
String name = spellType.name();
if (name.endsWith("STRIKE")) {
return victim instanceof Npc && ((Npc) victim).getId() == 205 ? (80 + t) : (2 * t);
} else if (name.endsWith("BOLT")) {
return source.getEquipment().getItem(Equipment.SLOT_HANDS).getId() == 777 ? 110 + t : 80 + t;
} else if (name.endsWith("BLAST")) {
return 120 + t;
} else if (name.endsWith("WAVE")) {
return 160 + t;
} else if (name.endsWith("SURGE")) {
return 200 + (2 * t);
} else if (name.equals("CRUMBLE_UNDEAD")) {
return 150;
} else if (name.equals("MAGIC_DART")) {
return 100 + source.getSkills().getLevel(Skills.MAGIC);
} else if (name.equals("IBAN_BLAST")) {
return 250;
} else if (name.endsWith("GODSPELL")) {
return source.getIntegerAttribute("godSpellCharge") > /*GameEngine.getTicks()*1 ? 300 : 200;
/*} else if (name.endsWith("RUSH")) {
return 140 - t;
] else if (name.endsWith("BURST")) {
return 180 - t;
] else if (name.endsWith("BLITZ")) {
return 220 - t;
} else if (name.endsWith("BARRAGE")) {
return 260 - t;
}
return t;
}*/
}[/code]
[code]public int getLocalX(Location base) {
return X - [[base.getRegionX() - 6) << 3);
}

public int getLocalY() {
return getLocalY(this);
}

public int getLocalX(Location base) {
return x - ((base.getRegionX() - 6) << 3);
}

public int getLocalY() {
return getLocalY(this);
}[/code]
[code]submit(new NexAreaEvnet[]]:[/code]

Have fun! Note that there is a small anti-leech so everyone wouldnt have it.
Thank and Rep if you liked it.

Share this post


Link to post
Share on other sites
[url]http://www.rune-server.org/runescape-development/rs-503-client-server/snippets/376077-nex-dem-637-phases.html[/url] Edited by Emperial

Share this post


Link to post
Share on other sites
[quote name='Emperial']FAGGOT
[url]http://www.rune-server.org/runescape-development/rs-503-client-server/snippets/376077-nex-dem-637-phases.html[/url][/QUOTE]Please, be nice. I wrote that fully myself after your release so you got nothing to complain about.

Share this post


Link to post
Share on other sites
[url]http://www.rune-server.org/runescape-development/rs-503-client-server/snippets/376077-nex-dem-637-phases.html[/url]
See the date? I released nex yesterday. Edited by Emperial

Share this post


Link to post
Share on other sites
[quote name='Mystic Flow']Didn't I already release Nex o,o ?[/QUOTE]
For 634

Share this post


Link to post
Share on other sites
[quote name='Emperial']For 634[/QUOTE]

lol no, that Nex was straight out of thee 637 source :l

Edit: Ohhhhhhhhhhhhhhhhhhh, I forgot Emperor removed it when he added his combat system, my bad homie

Share this post


Link to post
Share on other sites
Sign in to follow this  

×