Counter Attack now only activates when the player is blocking

Closes #1018
This commit is contained in:
TfT_02 2013-08-20 23:23:49 +02:00
parent 07dd460d78
commit 51bf989418
6 changed files with 16 additions and 5 deletions

View File

@ -23,6 +23,7 @@ Version 1.4.07-dev
= Fixed a bug where teleport location was never reset if warmup was set to 0 for Chimaera Wing. = Fixed a bug where teleport location was never reset if warmup was set to 0 for Chimaera Wing.
= Fixed a bug where the Dodge DamageModifier wasn't being read from advanced.yml = Fixed a bug where the Dodge DamageModifier wasn't being read from advanced.yml
! Changed the way Repair hands out XP, also added config options to control Repair XP ! Changed the way Repair hands out XP, also added config options to control Repair XP
! Changed Swords "Counter Attack" ability from passive to active. Blocking is required to activate.
! Admin and Party chat prefixes are now customizable ! Admin and Party chat prefixes are now customizable
! Changed the color of party leader names in Party chat ! Changed the color of party leader names in Party chat
! Improved profile saving ! Improved profile saving

View File

@ -992,6 +992,7 @@ public class AdvancedConfig extends AutoUpdateConfigLoader {
public int getBleedMaxTicks() { return config.getInt("Skills.Swords.Bleed_MaxTicks", 3); } public int getBleedMaxTicks() { return config.getInt("Skills.Swords.Bleed_MaxTicks", 3); }
public int getBleedBaseTicks() { return config.getInt("Skills.Swords.Bleed_BaseTicks", 2); } public int getBleedBaseTicks() { return config.getInt("Skills.Swords.Bleed_BaseTicks", 2); }
public boolean getCounterRequiresBlock() { return config.getBoolean("Skills.Swords.Counter_RequiresBlock"); }
public double getCounterChanceMax() { return config.getDouble("Skills.Swords.Counter_ChanceMax", 30.0D); } public double getCounterChanceMax() { return config.getDouble("Skills.Swords.Counter_ChanceMax", 30.0D); }
public int getCounterMaxBonusLevel() { return config.getInt("Skills.Swords.Counter_MaxBonusLevel", 600); } public int getCounterMaxBonusLevel() { return config.getInt("Skills.Swords.Counter_MaxBonusLevel", 600); }
public int getCounterModifier() { return config.getInt("Skills.Swords.Counter_DamageModifier", 2); } public int getCounterModifier() { return config.getInt("Skills.Swords.Counter_DamageModifier", 2); }

View File

@ -8,9 +8,10 @@ public class Swords {
public static int bleedBaseTicks = AdvancedConfig.getInstance().getBleedBaseTicks(); public static int bleedBaseTicks = AdvancedConfig.getInstance().getBleedBaseTicks();
public static double bleedMaxChance = AdvancedConfig.getInstance().getBleedChanceMax(); public static double bleedMaxChance = AdvancedConfig.getInstance().getBleedChanceMax();
public static int counterAttackMaxBonusLevel = AdvancedConfig.getInstance().getCounterMaxBonusLevel(); public static boolean counterAttackRequiresBlock = AdvancedConfig.getInstance().getCounterRequiresBlock();
public static int counterAttackModifier = AdvancedConfig.getInstance().getCounterModifier(); public static int counterAttackMaxBonusLevel = AdvancedConfig.getInstance().getCounterMaxBonusLevel();
public static double counterAttackMaxChance = AdvancedConfig.getInstance().getCounterChanceMax(); public static int counterAttackModifier = AdvancedConfig.getInstance().getCounterModifier();
public static double counterAttackMaxChance = AdvancedConfig.getInstance().getCounterChanceMax();
public static int serratedStrikesModifier = AdvancedConfig.getInstance().getSerratedStrikesModifier(); public static int serratedStrikesModifier = AdvancedConfig.getInstance().getSerratedStrikesModifier();
public static int serratedStrikesBleedTicks = AdvancedConfig.getInstance().getSerratedStrikesTicks(); public static int serratedStrikesBleedTicks = AdvancedConfig.getInstance().getSerratedStrikesTicks();

View File

@ -4,6 +4,7 @@ import org.bukkit.entity.Entity;
import org.bukkit.entity.LivingEntity; import org.bukkit.entity.LivingEntity;
import org.bukkit.entity.Player; import org.bukkit.entity.Player;
import com.gmail.nossr50.config.AdvancedConfig;
import com.gmail.nossr50.datatypes.player.McMMOPlayer; import com.gmail.nossr50.datatypes.player.McMMOPlayer;
import com.gmail.nossr50.datatypes.skills.AbilityType; import com.gmail.nossr50.datatypes.skills.AbilityType;
import com.gmail.nossr50.datatypes.skills.SkillType; import com.gmail.nossr50.datatypes.skills.SkillType;
@ -67,6 +68,10 @@ public class SwordsManager extends SkillManager {
} }
public void counterAttackChecks(LivingEntity attacker, double damage) { public void counterAttackChecks(LivingEntity attacker, double damage) {
if (Swords.counterAttackRequiresBlock && !getPlayer().isBlocking()) {
return;
}
if (SkillUtils.activationSuccessful(getSkillLevel(), getActivationChance(), Swords.counterAttackMaxChance, Swords.counterAttackMaxBonusLevel)) { if (SkillUtils.activationSuccessful(getSkillLevel(), getActivationChance(), Swords.counterAttackMaxChance, Swords.counterAttackMaxBonusLevel)) {
CombatUtils.dealDamage(attacker, damage / Swords.counterAttackModifier); CombatUtils.dealDamage(attacker, damage / Swords.counterAttackModifier);

View File

@ -320,6 +320,9 @@ Skills:
Bleed_MaxTicks: 3 Bleed_MaxTicks: 3
Bleed_BaseTicks: 2 Bleed_BaseTicks: 2
# Counter_RequiresBlock: Determines if blocking is required to trigger counter attack
Counter_RequiresBlock: true
# Counter_ChanceMax: Maximum chance of triggering a counter attack # Counter_ChanceMax: Maximum chance of triggering a counter attack
# Counter_MaxBonusLevel: On this level, the chance to Counter will be Counter_ChanceMax # Counter_MaxBonusLevel: On this level, the chance to Counter will be Counter_ChanceMax
Counter_ChanceMax: 30.0 Counter_ChanceMax: 30.0

View File

@ -267,7 +267,7 @@ Swords.Combat.Counter.Hit=[[DARK_RED]]Hit with a counter-attack!
Swords.Combat.Countered=[[GREEN]]**COUNTER-ATTACKED** Swords.Combat.Countered=[[GREEN]]**COUNTER-ATTACKED**
Swords.Combat.SS.Struck=[[DARK_RED]]Struck by SERRATED STRIKES! Swords.Combat.SS.Struck=[[DARK_RED]]Struck by SERRATED STRIKES!
Swords.Effect.0=Counter Attack Swords.Effect.0=Counter Attack
Swords.Effect.1=Reflect {0} of damage taken Swords.Effect.1=Reflect {0} of damage taken while blocking
Swords.Effect.2=Serrated Strikes (ABILITY) Swords.Effect.2=Serrated Strikes (ABILITY)
Swords.Effect.3={0} DMG AoE, Bleed+ AoE Swords.Effect.3={0} DMG AoE, Bleed+ AoE
Swords.Effect.4=Serrated Strikes Bleed+ Swords.Effect.4=Serrated Strikes Bleed+
@ -628,7 +628,7 @@ Guides.Mining=[[DARK_AQUA]]About Mining:\n[[YELLOW]]Mining consists of mining st
Guides.Page.Invalid=Not a valid page number! Guides.Page.Invalid=Not a valid page number!
Guides.Page.OutOfRange=That page does not exist, there are only {0} total pages. Guides.Page.OutOfRange=That page does not exist, there are only {0} total pages.
Guides.Repair=[[DARK_AQUA]]About Repair:\n[[YELLOW]]Repair allows you to use an iron block to repair armor and\n[[YELLOW]]tools, or a gold block to salvage armor and tools.\n\n[[DARK_AQUA]]XP GAIN:\n[[YELLOW]]Repair tools or armor using the mcMMO Anvil. This is an\n[[YELLOW]]iron block by default and should not be confused with\n[[YELLOW]]the Vanilla Minecraft Anvil.\n[[DARK_AQUA]]How can I use Repair?\n[[YELLOW]]Place down a mcMMO Anvil and right-click to repair the item \n[[YELLOW]]you're currently holding. This consumes 1 item on every use.\n\n[[DARK_AQUA]]How does Repair Mastery work?\n[[YELLOW]]Repair Mastery increases the repair amount. The extra amount\n[[YELLOW]]repaired is influenced by your Repair skill level.\n\n[[DARK_AQUA]]How does Super Repair work?\n[[YELLOW]]Super Repair is a passive ability. When repairing an item,\n[[YELLOW]]it grants players a chance to repair an item with\n[[YELLOW]]double effectiveness.\n\n\n\n\n[[DARK_AQUA]]How does Arcane Forging work?\n[[YELLOW]]This passive ability allows you to repair items with a certain\n[[YELLOW]]chance of maintaining its enchantments. The enchants may be\n[[YELLOW]]kept at their existing levels, downgraded to a lower level,\n[[YELLOW]]or lost entirely.\n\n\n\n[[DARK_AQUA]]How does Salvage work?\n[[YELLOW]]Place down a mcMMO Salvage Anvil and right-click to salvage\n[[YELLOW]]the item you're currently holding.\n[[YELLOW]]This will break the item apart en give back the used ingots.\n[[YELLOW]]Note: You can only salvage fully repaired tools or armor. Guides.Repair=[[DARK_AQUA]]About Repair:\n[[YELLOW]]Repair allows you to use an iron block to repair armor and\n[[YELLOW]]tools, or a gold block to salvage armor and tools.\n\n[[DARK_AQUA]]XP GAIN:\n[[YELLOW]]Repair tools or armor using the mcMMO Anvil. This is an\n[[YELLOW]]iron block by default and should not be confused with\n[[YELLOW]]the Vanilla Minecraft Anvil.\n[[DARK_AQUA]]How can I use Repair?\n[[YELLOW]]Place down a mcMMO Anvil and right-click to repair the item \n[[YELLOW]]you're currently holding. This consumes 1 item on every use.\n\n[[DARK_AQUA]]How does Repair Mastery work?\n[[YELLOW]]Repair Mastery increases the repair amount. The extra amount\n[[YELLOW]]repaired is influenced by your Repair skill level.\n\n[[DARK_AQUA]]How does Super Repair work?\n[[YELLOW]]Super Repair is a passive ability. When repairing an item,\n[[YELLOW]]it grants players a chance to repair an item with\n[[YELLOW]]double effectiveness.\n\n\n\n\n[[DARK_AQUA]]How does Arcane Forging work?\n[[YELLOW]]This passive ability allows you to repair items with a certain\n[[YELLOW]]chance of maintaining its enchantments. The enchants may be\n[[YELLOW]]kept at their existing levels, downgraded to a lower level,\n[[YELLOW]]or lost entirely.\n\n\n\n[[DARK_AQUA]]How does Salvage work?\n[[YELLOW]]Place down a mcMMO Salvage Anvil and right-click to salvage\n[[YELLOW]]the item you're currently holding.\n[[YELLOW]]This will break the item apart en give back the used ingots.\n[[YELLOW]]Note: You can only salvage fully repaired tools or armor.
Guides.Swords=[[DARK_AQUA]]About Swords:\n[[YELLOW]]This skill awards combat bonuses to anyone fighting with a\n[[YELLOW]]sword.\n\n[[DARK_AQUA]]XP GAIN:\n[[YELLOW]]XP is gained based on the amount of damage dealt to mobs or \n[[YELLOW]]other players when wielding a sword.\n\n[[DARK_AQUA]]How does Serrated Strikes work?\n[[YELLOW]]Serrated Strikes is an active ability, you can activate it by\n[[YELLOW]]right-clicking with a sword. This ability allows you to deal \n[[YELLOW]]an AoE (Area of Effect) hit. This AoE will do a bonus 25%\n[[YELLOW]]damage and will inflict a bleed effect that lasts for 5 ticks.\n\n\n\n[[DARK_AQUA]]How does Counter Attack work?\n[[YELLOW]]Counter Attack is a passive ability. When taking hits from mobs,\n[[YELLOW]]you will have a chance to reflect 50% of the damage that was \n[[YELLOW]]taken.\n\n\n\n\n[[DARK_AQUA]]How does Bleed work?\n[[YELLOW]]Bleed causes enemies to take damage every two seconds. The \n[[YELLOW]]target will bleed until the effect wears off, or death, \n[[YELLOW]]whichever comes first.\n[[YELLOW]]The duration of the bleed is increased by your sword skill. Guides.Swords=[[DARK_AQUA]]About Swords:\n[[YELLOW]]This skill awards combat bonuses to anyone fighting with a\n[[YELLOW]]sword.\n\n[[DARK_AQUA]]XP GAIN:\n[[YELLOW]]XP is gained based on the amount of damage dealt to mobs or \n[[YELLOW]]other players when wielding a sword.\n\n[[DARK_AQUA]]How does Serrated Strikes work?\n[[YELLOW]]Serrated Strikes is an active ability, you can activate it by\n[[YELLOW]]right-clicking with a sword. This ability allows you to deal \n[[YELLOW]]an AoE (Area of Effect) hit. This AoE will do a bonus 25%\n[[YELLOW]]damage and will inflict a bleed effect that lasts for 5 ticks.\n\n\n\n[[DARK_AQUA]]How does Counter Attack work?\n[[YELLOW]]Counter Attack is an active ability. When blocking and taking\n[[YELLOW]]hits from mobs, you will have a chance to reflect 50% of \n[[YELLOW]]the damage that was taken.\n\n\n\n\n[[DARK_AQUA]]How does Bleed work?\n[[YELLOW]]Bleed causes enemies to take damage every two seconds. The \n[[YELLOW]]target will bleed until the effect wears off, or death, \n[[YELLOW]]whichever comes first.\n[[YELLOW]]The duration of the bleed is increased by your sword skill.
Guides.Smelting=Coming soon... Guides.Smelting=Coming soon...
Guides.Taming=[[DARK_AQUA]]About Taming:\n[[YELLOW]]Taming will give players various combat bonuses when using\n[[YELLOW]]tamed wolves.\n\n[[DARK_AQUA]]XP GAIN:\n[[YELLOW]]To gain XP in this skill, you need to tame wolves/ocelots or\n[[YELLOW]]get into combat with your wolves.\n\n[[DARK_AQUA]]How does Call of the Wild work?\n[[YELLOW]]Call of the Wild is an active ability that will allow you to summon\n[[YELLOW]]a wolf or an ocelot by your side. You can do this by\n[[YELLOW]]left-clicking while holding bones or fish.\n\n[[DARK_AQUA]]How does Beast Lore work?\n[[YELLOW]]Beast Lore allows players to inspect pets and to check the\n[[YELLOW]]stats of wolves and ocelots. Left-click a wolf or ocelot to use\n[[YELLOW]]Beast Lore.\n[[DARK_AQUA]]How does Gore work?\n[[YELLOW]]Gore is a passive ability that has a chance of inflicting a\n[[YELLOW]]bleeding effect on your wolves' targets.\n\n[[DARK_AQUA]]How does Sharpened Claws work?\n[[YELLOW]]Sharpened Claws provides a damage bonus to damage dealt\n[[YELLOW]]by wolves. The damage bonus depends on your Taming level.\n\n[[DARK_AQUA]]How does Environmentally Aware work?\n[[YELLOW]]This passive ability will allow wolves to teleport to you when\n[[YELLOW]]they get near hazards, such as Cacti/Lava. It will also give\n[[YELLOW]]wolves fall damage immunity.\n\n[[DARK_AQUA]]How does Thick Fur work?\n[[YELLOW]]This passive ability will reduce damage and make wolves\n[[YELLOW]]fire resistant.\n[[DARK_AQUA]]How does Shock Proof work?\n[[YELLOW]]This passive ability reduces damage done to wolves\n[[YELLOW]]from explosions.\n[[DARK_AQUA]]How does Fast Food Service work?\n[[YELLOW]]This passive ability gives wolves a chance to heal whenever\n[[YELLOW]]they perform an attack. Guides.Taming=[[DARK_AQUA]]About Taming:\n[[YELLOW]]Taming will give players various combat bonuses when using\n[[YELLOW]]tamed wolves.\n\n[[DARK_AQUA]]XP GAIN:\n[[YELLOW]]To gain XP in this skill, you need to tame wolves/ocelots or\n[[YELLOW]]get into combat with your wolves.\n\n[[DARK_AQUA]]How does Call of the Wild work?\n[[YELLOW]]Call of the Wild is an active ability that will allow you to summon\n[[YELLOW]]a wolf or an ocelot by your side. You can do this by\n[[YELLOW]]left-clicking while holding bones or fish.\n\n[[DARK_AQUA]]How does Beast Lore work?\n[[YELLOW]]Beast Lore allows players to inspect pets and to check the\n[[YELLOW]]stats of wolves and ocelots. Left-click a wolf or ocelot to use\n[[YELLOW]]Beast Lore.\n[[DARK_AQUA]]How does Gore work?\n[[YELLOW]]Gore is a passive ability that has a chance of inflicting a\n[[YELLOW]]bleeding effect on your wolves' targets.\n\n[[DARK_AQUA]]How does Sharpened Claws work?\n[[YELLOW]]Sharpened Claws provides a damage bonus to damage dealt\n[[YELLOW]]by wolves. The damage bonus depends on your Taming level.\n\n[[DARK_AQUA]]How does Environmentally Aware work?\n[[YELLOW]]This passive ability will allow wolves to teleport to you when\n[[YELLOW]]they get near hazards, such as Cacti/Lava. It will also give\n[[YELLOW]]wolves fall damage immunity.\n\n[[DARK_AQUA]]How does Thick Fur work?\n[[YELLOW]]This passive ability will reduce damage and make wolves\n[[YELLOW]]fire resistant.\n[[DARK_AQUA]]How does Shock Proof work?\n[[YELLOW]]This passive ability reduces damage done to wolves\n[[YELLOW]]from explosions.\n[[DARK_AQUA]]How does Fast Food Service work?\n[[YELLOW]]This passive ability gives wolves a chance to heal whenever\n[[YELLOW]]they perform an attack.
Guides.Unarmed=[[DARK_AQUA]]About Unarmed:\n[[YELLOW]]Unarmed will give players various combat bonuses when using\n[[YELLOW]]your fists as a weapon. \n\n[[DARK_AQUA]]XP GAIN:\n[[YELLOW]]XP is gained based on the amount of damage dealt to mobs \n[[YELLOW]]or other players when unarmed.\n\n[[DARK_AQUA]]How does Berserk work?\n[[YELLOW]]Beserk is an active ability that is activated by\n[[YELLOW]]right-clicking. While in Beserk mode, you deal 50% more\n[[YELLOW]]damage and you can break weak materials instantly, such as\n[[YELLOW]]Dirt and Grass.\n[[DARK_AQUA]]How does Iron Arm work?\n[[YELLOW]]Iron Arm increases the damage dealt when hitting mobs or\n[[YELLOW]]players with your fists.\n[[DARK_AQUA]]How does Arrow Deflect work?\n[[YELLOW]]Arrow Deflect is a passive ability that gives you a chance\n[[YELLOW]]to deflect arrows shot by Skeletons or other players.\n[[YELLOW]]The arrow will fall harmlessly to the ground.\n\n[[DARK_AQUA]]How does Iron Grip work?\n[[YELLOW]]Iron Grip is a passive ability that counters disarm. As your\n[[YELLOW]]unarmed level increases, the chance of preventing a disarm increases.\n[[DARK_AQUA]]How does Disarm work?\n[[YELLOW]]This passive ability allows players to disarm other players,\n[[YELLOW]]causing the target's equipped item to fall to the ground. Guides.Unarmed=[[DARK_AQUA]]About Unarmed:\n[[YELLOW]]Unarmed will give players various combat bonuses when using\n[[YELLOW]]your fists as a weapon. \n\n[[DARK_AQUA]]XP GAIN:\n[[YELLOW]]XP is gained based on the amount of damage dealt to mobs \n[[YELLOW]]or other players when unarmed.\n\n[[DARK_AQUA]]How does Berserk work?\n[[YELLOW]]Beserk is an active ability that is activated by\n[[YELLOW]]right-clicking. While in Beserk mode, you deal 50% more\n[[YELLOW]]damage and you can break weak materials instantly, such as\n[[YELLOW]]Dirt and Grass.\n[[DARK_AQUA]]How does Iron Arm work?\n[[YELLOW]]Iron Arm increases the damage dealt when hitting mobs or\n[[YELLOW]]players with your fists.\n[[DARK_AQUA]]How does Arrow Deflect work?\n[[YELLOW]]Arrow Deflect is a passive ability that gives you a chance\n[[YELLOW]]to deflect arrows shot by Skeletons or other players.\n[[YELLOW]]The arrow will fall harmlessly to the ground.\n\n[[DARK_AQUA]]How does Iron Grip work?\n[[YELLOW]]Iron Grip is a passive ability that counters disarm. As your\n[[YELLOW]]unarmed level increases, the chance of preventing a disarm increases.\n[[DARK_AQUA]]How does Disarm work?\n[[YELLOW]]This passive ability allows players to disarm other players,\n[[YELLOW]]causing the target's equipped item to fall to the ground.