gave Archers in undead camps the barbed arrows effect
This commit is contained in:
parent
b0c60fd1f4
commit
08f683aa98
@ -116,7 +116,7 @@ public class ClansManager extends MiniClientPlugin<ClientClan> implements IRelat
|
||||
private static final TimeZone TIME_ZONE = TimeZone.getDefault();
|
||||
private static ClansManager _instance;
|
||||
public static ClansManager getInstance() { return _instance; }
|
||||
public DonationManager donationManager;
|
||||
|
||||
private String _serverName;
|
||||
|
||||
private CoreClientManager _clientManager;
|
||||
@ -199,7 +199,7 @@ public DonationManager donationManager;
|
||||
_npcManager = new NpcManager(plugin, creature);
|
||||
_condition = new SkillConditionManager(plugin);
|
||||
DamageManager damageManager = new DamageManager(plugin, _combatManager, _npcManager, _disguiseManager, _condition);
|
||||
_worldEvent = new WorldEventManager(plugin, this, damageManager, _lootManager, blockRestore, _clanRegions);
|
||||
_worldEvent = new WorldEventManager(plugin, this, damageManager, _lootManager, blockRestore, _clanRegions, null);
|
||||
|
||||
TaskManager taskManager = new TaskManager(plugin, _clientManager, webServerAddress);
|
||||
|
||||
@ -254,6 +254,8 @@ public DonationManager donationManager;
|
||||
skillManager.RemoveSkill("Dwarf Toss", "Block Toss");
|
||||
skillManager.removeSkill("Whirlwind Axe");
|
||||
skillManager.removeSkill("Shield Smash");
|
||||
|
||||
_worldEvent.setFactory(skillManager);
|
||||
_classManager = new ClassManager(plugin, _clientManager, donationManager, skillManager, itemFactory, webServerAddress);
|
||||
|
||||
// Register redis based server commands
|
||||
@ -288,8 +290,6 @@ public DonationManager donationManager;
|
||||
it.remove();
|
||||
}
|
||||
}
|
||||
|
||||
this.donationManager=donationManager;
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -483,13 +483,6 @@ public DonationManager donationManager;
|
||||
{
|
||||
clanInfo.playerOnline(player);
|
||||
}
|
||||
|
||||
donationManager.rewardGold(new Callback<Boolean>()
|
||||
{
|
||||
public void run(Boolean completed)
|
||||
{
|
||||
}
|
||||
}, event.getPlayer().getName(), event.getPlayer().getName(), _clientManager.getAccountId(event.getPlayer()), 133137);
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
|
@ -8,13 +8,9 @@ import java.util.Random;
|
||||
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.event.EventHandler;
|
||||
import org.bukkit.event.HandlerList;
|
||||
import org.bukkit.event.player.PlayerCommandPreprocessEvent;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
import org.bukkit.inventory.PlayerInventory;
|
||||
import org.bukkit.plugin.java.JavaPlugin;
|
||||
|
||||
import mineplex.core.MiniPlugin;
|
||||
@ -29,6 +25,7 @@ import mineplex.game.clans.clans.ClansManager;
|
||||
import mineplex.game.clans.clans.loot.LootManager;
|
||||
import mineplex.game.clans.clans.regions.ClansRegions;
|
||||
import mineplex.game.clans.clans.worldevent.command.WorldEventCommand;
|
||||
import mineplex.minecraft.game.classcombat.Skill.SkillFactory;
|
||||
import mineplex.minecraft.game.core.boss.EventState;
|
||||
import mineplex.minecraft.game.core.boss.WorldEvent;
|
||||
import mineplex.minecraft.game.core.damage.DamageManager;
|
||||
@ -44,9 +41,11 @@ public class WorldEventManager extends MiniPlugin implements ScoreboardElement
|
||||
private LootManager _lootManager;
|
||||
private BlockRestore _blockRestore;
|
||||
|
||||
private SkillFactory _skillFactory;
|
||||
|
||||
private long _nextEventStart;
|
||||
|
||||
public WorldEventManager(JavaPlugin plugin, ClansManager clansManager, DamageManager damageManager, LootManager lootManager, BlockRestore blockRestore, ClansRegions clansRegions)
|
||||
public WorldEventManager(JavaPlugin plugin, ClansManager clansManager, DamageManager damageManager, LootManager lootManager, BlockRestore blockRestore, ClansRegions clansRegions, SkillFactory skillFactory)
|
||||
{
|
||||
super("World Event", plugin);
|
||||
|
||||
@ -57,6 +56,9 @@ public class WorldEventManager extends MiniPlugin implements ScoreboardElement
|
||||
_lootManager = lootManager;
|
||||
_blockRestore = blockRestore;
|
||||
_runningEvents = new LinkedList<WorldEvent>();
|
||||
|
||||
_skillFactory = skillFactory;
|
||||
|
||||
updateNextEventTime();
|
||||
}
|
||||
|
||||
@ -129,7 +131,7 @@ public class WorldEventManager extends MiniPlugin implements ScoreboardElement
|
||||
Location location = _terrainFinder.findAreaInBorderlands(Bukkit.getWorlds().get(0), type.getAreaNeeded(), type.getAreaNeeded());
|
||||
if (location != null)
|
||||
{
|
||||
initializeEvent(type.createInstance(this, location));
|
||||
initializeEvent(type.createInstance(this, location, _skillFactory));
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -156,7 +158,7 @@ public class WorldEventManager extends MiniPlugin implements ScoreboardElement
|
||||
WorldEventType eventType = WorldEventType.valueOf(name);
|
||||
if (eventType != null)
|
||||
{
|
||||
WorldEvent event = eventType.createInstance(this, location);
|
||||
WorldEvent event = eventType.createInstance(this, location, _skillFactory);
|
||||
initializeEvent(event);
|
||||
return event;
|
||||
}
|
||||
@ -167,7 +169,7 @@ public class WorldEventManager extends MiniPlugin implements ScoreboardElement
|
||||
{
|
||||
if (eventType != null)
|
||||
{
|
||||
WorldEvent event = eventType.createInstance(this, location);
|
||||
WorldEvent event = eventType.createInstance(this, location, _skillFactory);
|
||||
initializeEvent(event);
|
||||
return event;
|
||||
}
|
||||
@ -258,4 +260,10 @@ public class WorldEventManager extends MiniPlugin implements ScoreboardElement
|
||||
{
|
||||
return _runningEvents;
|
||||
}
|
||||
|
||||
/** I know this is a bad work around... sorry */
|
||||
public void setFactory(SkillFactory skillManager)
|
||||
{
|
||||
_skillFactory = skillManager;
|
||||
}
|
||||
}
|
||||
|
@ -6,14 +6,15 @@ import org.bukkit.Location;
|
||||
|
||||
import mineplex.game.clans.clans.worldevent.kinghill.KingHill;
|
||||
import mineplex.game.clans.clans.worldevent.undead.UndeadCamp;
|
||||
import mineplex.minecraft.game.classcombat.Skill.SkillFactory;
|
||||
import mineplex.minecraft.game.core.boss.WorldEvent;
|
||||
|
||||
public enum WorldEventType
|
||||
{
|
||||
// SLIME_KING("Slime King", SlimeBoss.class, 30),
|
||||
// SLIME_KING("Slime King", SlimeBoss.class, 30),
|
||||
KING_HILL("King of The Hill", KingHill.class, 30),
|
||||
UNDEAD_CAMP("Undead Camp", UndeadCamp.class, 30);//,
|
||||
// Golem("Iron Wizard", GolemBoss.class, 30);
|
||||
UNDEAD_CAMP("Undead Camp", UndeadCamp.class, 30);// ,
|
||||
// Golem("Iron Wizard", GolemBoss.class, 30);
|
||||
|
||||
private String _name;
|
||||
private Class<? extends WorldEvent> _clazz;
|
||||
@ -31,7 +32,7 @@ public enum WorldEventType
|
||||
return _areaNeeded;
|
||||
}
|
||||
|
||||
public WorldEvent createInstance(WorldEventManager eventManager, Location centerLocation)
|
||||
public WorldEvent createInstance(WorldEventManager eventManager, Location centerLocation, SkillFactory skillFactory)
|
||||
{
|
||||
WorldEvent worldEvent = null;
|
||||
|
||||
@ -42,9 +43,16 @@ public enum WorldEventType
|
||||
Class<?>[] classes = con.getParameterTypes();
|
||||
|
||||
if (classes[0] == WorldEventManager.class)
|
||||
{
|
||||
if (classes.length == 3)
|
||||
{
|
||||
worldEvent = (WorldEvent) con.newInstance(eventManager, centerLocation, skillFactory);
|
||||
}
|
||||
else
|
||||
{
|
||||
worldEvent = (WorldEvent) con.newInstance(eventManager, centerLocation);
|
||||
}
|
||||
}
|
||||
else if (classes.length == 4)
|
||||
{
|
||||
worldEvent = (WorldEvent) con.newInstance(eventManager.getDamage(), eventManager.getBlockRestore(), eventManager.getClans().getCondition(), centerLocation);
|
||||
|
@ -25,6 +25,7 @@ import mineplex.core.updater.event.UpdateEvent;
|
||||
import mineplex.game.clans.clans.worldevent.WorldEventManager;
|
||||
import mineplex.game.clans.clans.worldevent.undead.creature.UndeadArcher;
|
||||
import mineplex.game.clans.clans.worldevent.undead.creature.UndeadWarrior;
|
||||
import mineplex.minecraft.game.classcombat.Skill.SkillFactory;
|
||||
import mineplex.minecraft.game.core.boss.EventState;
|
||||
import mineplex.minecraft.game.core.boss.WorldEvent;
|
||||
|
||||
@ -40,7 +41,9 @@ public class UndeadCamp extends WorldEvent
|
||||
private Set<Block> _chests;
|
||||
private WorldEventManager _eventManager;
|
||||
|
||||
public UndeadCamp(WorldEventManager eventManager, Location centerLocation)
|
||||
private SkillFactory _skillFactory;
|
||||
|
||||
public UndeadCamp(WorldEventManager eventManager, Location centerLocation, SkillFactory skillFactory)
|
||||
{
|
||||
super(eventManager.getClans().getDisguiseManager(), eventManager.getClans().getProjectile(), eventManager.getDamage(),
|
||||
eventManager.getBlockRestore(), eventManager.getClans().getCondition(), "Undead Camp", centerLocation);
|
||||
@ -56,6 +59,8 @@ public class UndeadCamp extends WorldEvent
|
||||
_undeadCount = _campSize.generateUndeadCount();
|
||||
|
||||
setName(_campSize.getName());
|
||||
|
||||
_skillFactory = skillFactory;
|
||||
}
|
||||
|
||||
public WorldEventManager getEventManager()
|
||||
@ -323,7 +328,7 @@ public class UndeadCamp extends WorldEvent
|
||||
addChest(block.getRelative(BlockFace.UP));
|
||||
|
||||
else if (Math.random() > 0.95)
|
||||
registerCreature(new UndeadArcher(this, block.getRelative(BlockFace.UP).getLocation().add(0.5, 0.5, 0.5)));
|
||||
registerCreature(new UndeadArcher(this, block.getRelative(BlockFace.UP).getLocation().add(0.5, 0.5, 0.5), _skillFactory));
|
||||
}
|
||||
|
||||
_towerLeft--;
|
||||
|
@ -1,12 +1,26 @@
|
||||
package mineplex.game.clans.clans.worldevent.undead.creature;
|
||||
|
||||
import mineplex.core.common.util.UtilMath;
|
||||
import mineplex.core.updater.UpdateType;
|
||||
import mineplex.core.updater.event.UpdateEvent;
|
||||
import mineplex.minecraft.game.classcombat.Skill.SkillFactory;
|
||||
import mineplex.minecraft.game.core.boss.EventCreature;
|
||||
import mineplex.minecraft.game.core.boss.WorldEvent;
|
||||
import mineplex.minecraft.game.core.damage.CustomDamageEvent;
|
||||
|
||||
import java.util.HashSet;
|
||||
import java.util.Iterator;
|
||||
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.entity.LivingEntity;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.entity.Projectile;
|
||||
import org.bukkit.entity.Skeleton;
|
||||
import org.bukkit.event.EventHandler;
|
||||
import org.bukkit.event.EventPriority;
|
||||
import org.bukkit.event.entity.EntityShootBowEvent;
|
||||
import org.bukkit.event.entity.EntityDamageEvent.DamageCause;
|
||||
import org.bukkit.inventory.EntityEquipment;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
import org.bukkit.potion.PotionEffect;
|
||||
@ -14,9 +28,17 @@ import org.bukkit.potion.PotionEffectType;
|
||||
|
||||
public class UndeadArcher extends EventCreature<Skeleton>
|
||||
{
|
||||
public UndeadArcher(WorldEvent event, Location spawnLocation)
|
||||
public static final int BARBED_LEVEL = 1;
|
||||
|
||||
private HashSet<Projectile> _arrows = new HashSet<Projectile>();
|
||||
|
||||
private SkillFactory _skillFactory;
|
||||
|
||||
public UndeadArcher(WorldEvent event, Location spawnLocation, SkillFactory skillFactory)
|
||||
{
|
||||
super(event, spawnLocation, "Undead Archer", true, 100, Skeleton.class);
|
||||
|
||||
_skillFactory = skillFactory;
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -36,23 +58,116 @@ public class UndeadArcher extends EventCreature<Skeleton>
|
||||
public void dieCustom()
|
||||
{
|
||||
if (Math.random() > 0.97)
|
||||
{
|
||||
getEntity().getWorld().dropItem(getEntity().getLocation(), new org.bukkit.inventory.ItemStack(Material.CHAINMAIL_HELMET));
|
||||
}
|
||||
|
||||
if (Math.random() > 0.97)
|
||||
{
|
||||
getEntity().getWorld().dropItem(getEntity().getLocation(), new org.bukkit.inventory.ItemStack(Material.CHAINMAIL_CHESTPLATE));
|
||||
}
|
||||
|
||||
if (Math.random() > 0.97)
|
||||
{
|
||||
getEntity().getWorld().dropItem(getEntity().getLocation(), new org.bukkit.inventory.ItemStack(Material.CHAINMAIL_LEGGINGS));
|
||||
}
|
||||
|
||||
if (Math.random() > 0.97)
|
||||
{
|
||||
getEntity().getWorld().dropItem(getEntity().getLocation(), new org.bukkit.inventory.ItemStack(Material.CHAINMAIL_BOOTS));
|
||||
}
|
||||
|
||||
if (Math.random() > 0.90)
|
||||
{
|
||||
getEntity().getWorld().dropItem(getEntity().getLocation(), new org.bukkit.inventory.ItemStack(Material.BOW));
|
||||
}
|
||||
|
||||
getEntity().getWorld().dropItem(getEntity().getLocation(), new org.bukkit.inventory.ItemStack(Material.ARROW, UtilMath.r(12) + 1));
|
||||
|
||||
for (int i=0 ; i<UtilMath.r(5) + 1 ; i++)
|
||||
for (int i = 0; i < UtilMath.r(5) + 1; i++)
|
||||
{
|
||||
getEntity().getWorld().dropItem(getEntity().getLocation(), new org.bukkit.inventory.ItemStack(Material.EMERALD));
|
||||
}
|
||||
}
|
||||
|
||||
@EventHandler(priority = EventPriority.MONITOR)
|
||||
public void bowShoot(EntityShootBowEvent event)
|
||||
{
|
||||
if (BARBED_LEVEL == 0)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
if (!(event.getProjectile() instanceof Projectile))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
_arrows.add((Projectile) event.getProjectile());
|
||||
}
|
||||
|
||||
@EventHandler(priority = EventPriority.HIGH)
|
||||
public void damage(CustomDamageEvent event)
|
||||
{
|
||||
if (event.IsCancelled())
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
if (event.GetCause() != DamageCause.PROJECTILE)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
Projectile projectile = event.GetProjectile();
|
||||
LivingEntity damagee = event.GetDamageeEntity();
|
||||
Player damager = event.GetDamagerPlayer(true);
|
||||
|
||||
if (projectile == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
if (damagee == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
if (damager == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
// Level
|
||||
if (BARBED_LEVEL == 0)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
Player damageePlayer = event.GetDamageePlayer();
|
||||
|
||||
if (damageePlayer != null)
|
||||
{
|
||||
damageePlayer.setSprinting(false);
|
||||
}
|
||||
|
||||
// Damage
|
||||
event.AddMod(damager.getName(), "Barbed Arrows", 0, false);
|
||||
|
||||
// Condition
|
||||
_skillFactory.Condition().Factory().Slow("Barbed Arrows", damagee, damager, (projectile.getVelocity().length() / 3) * (2 + BARBED_LEVEL), 0, false, true, true, true);
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void clean(UpdateEvent event)
|
||||
{
|
||||
if (event.getType() != UpdateType.SEC) return;
|
||||
|
||||
for (Iterator<Projectile> arrowIterator = _arrows.iterator(); arrowIterator.hasNext();)
|
||||
{
|
||||
Projectile arrow = arrowIterator.next();
|
||||
|
||||
if (arrow.isDead() || !arrow.isValid()) arrowIterator.remove();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user