Skip to content

Commit

Permalink
Complete damage overhaul
Browse files Browse the repository at this point in the history
Fixed targeting for friendly mobs
Added basic guild support
Added UniqueSpawnEvent to edit uniques
Boost overhaul
  • Loading branch information
UltraFaceguy committed May 11, 2020
1 parent 42d5204 commit 2399745
Show file tree
Hide file tree
Showing 70 changed files with 1,334 additions and 792 deletions.
15 changes: 11 additions & 4 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@
</parent>

<artifactId>strife</artifactId>
<version>3.0.6-SNAPSHOT</version>
<version>3.0.6</version>
<packaging>jar</packaging>

<name>strife</name>
Expand Down Expand Up @@ -77,7 +77,7 @@
<dependency>
<groupId>io.pixeloutlaw</groupId>
<artifactId>facecore</artifactId>
<version>1.15.2.4</version>
<version>1.15.2.5</version>
<scope>provided</scope>
</dependency>
<dependency>
Expand All @@ -89,7 +89,7 @@
<dependency>
<groupId>LibsDisguises</groupId>
<artifactId>LibsDisguises</artifactId>
<version>9.9.9-SNAPSHOT</version>
<version>10.0.5-SNAPSHOT</version>
<scope>provided</scope>
</dependency>
<dependency>
Expand All @@ -101,9 +101,16 @@
<dependency>
<groupId>com.github.UltraFaceguy</groupId>
<artifactId>SnazzyParties</artifactId>
<version>1.0.2</version>
<version>1.0.4</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>me.glaremasters</groupId>
<artifactId>guilds</artifactId>
<version>3.5.4.9</version>
<scope>system</scope>
<systemPath>${basedir}/lib/Guilds-3.5.4.9.jar</systemPath>
</dependency>
<dependency>
<groupId>com.github.shynixn.headdatabase</groupId>
<artifactId>hdb-api</artifactId>
Expand Down
65 changes: 47 additions & 18 deletions src/main/java/land/face/strife/StrifePlugin.java
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,7 @@
import land.face.strife.managers.BarrierManager;
import land.face.strife.managers.BleedManager;
import land.face.strife.managers.BlockManager;
import land.face.strife.managers.BoostManager;
import land.face.strife.managers.BossBarManager;
import land.face.strife.managers.BuffManager;
import land.face.strife.managers.ChampionManager;
Expand All @@ -98,7 +99,6 @@
import land.face.strife.managers.EnergyManager;
import land.face.strife.managers.EntityEquipmentManager;
import land.face.strife.managers.ExperienceManager;
import land.face.strife.managers.GlobalBoostManager;
import land.face.strife.managers.IndicatorManager;
import land.face.strife.managers.LoreAbilityManager;
import land.face.strife.managers.MinionManager;
Expand Down Expand Up @@ -126,12 +126,13 @@
import land.face.strife.storage.FlatfileStorage;
import land.face.strife.tasks.AbilityTickTask;
import land.face.strife.tasks.BarrierTask;
import land.face.strife.tasks.BoostTickTask;
import land.face.strife.tasks.BossBarsTask;
import land.face.strife.tasks.CombatStatusTask;
import land.face.strife.tasks.DamageOverTimeTask;
import land.face.strife.tasks.EnergyRegenTask;
import land.face.strife.tasks.EveryTickTask;
import land.face.strife.tasks.ForceAttackSpeed;
import land.face.strife.tasks.GlobalMultiplierTask;
import land.face.strife.tasks.IndicatorTask;
import land.face.strife.tasks.MinionDecayTask;
import land.face.strife.tasks.ParticleTask;
Expand Down Expand Up @@ -213,7 +214,7 @@ public class StrifePlugin extends FacePlugin {
private CombatStatusManager combatStatusManager;
private SpawnerManager spawnerManager;
private MobModManager mobModManager;
private GlobalBoostManager globalBoostManager;
private BoostManager boostManager;
private SoulManager soulManager;
private EnergyManager energyManager;
private WSEManager wseManager;
Expand All @@ -223,6 +224,7 @@ public class StrifePlugin extends FacePlugin {

private List<BukkitTask> taskList = new ArrayList<>();
private ParticleTask particleTask;
private DamageOverTimeTask damageOverTimeTask;
private EnergyRegenTask energyRegenTask;
private RegenTask regenTask;

Expand All @@ -241,9 +243,12 @@ public static StrifePlugin getInstance() {
return instance;
}

public StrifePlugin() {
instance = this;
}

@Override
public void enable() {
instance = this;
debugPrinter = new PluginLogger(this);

List<VersionedSmartYamlConfiguration> configurations = new ArrayList<>();
Expand Down Expand Up @@ -292,7 +297,7 @@ public void enable() {
attackSpeedManager = new AttackSpeedManager(this);
indicatorManager = new IndicatorManager();
equipmentManager = new EntityEquipmentManager();
globalBoostManager = new GlobalBoostManager();
boostManager = new BoostManager(this);
soulManager = new SoulManager(this);
energyManager = new EnergyManager(this);
barrierManager = new BarrierManager();
Expand Down Expand Up @@ -344,13 +349,14 @@ public void enable() {
BarrierTask barrierTask = new BarrierTask(this);
BossBarsTask bossBarsTask = new BossBarsTask(bossBarManager);
MinionDecayTask minionDecayTask = new MinionDecayTask(minionManager);
GlobalMultiplierTask globalMultiplierTask = new GlobalMultiplierTask(globalBoostManager);
BoostTickTask boostTickTask = new BoostTickTask(boostManager);
SpawnerSpawnTask spawnerSpawnTask = new SpawnerSpawnTask(spawnerManager);
AbilityTickTask iconDuraTask = new AbilityTickTask(abilityManager);
VirtualEntityTask virtualEntityTask = new VirtualEntityTask();
CombatStatusTask combatStatusTask = new CombatStatusTask(combatStatusManager);
EveryTickTask everyTickTask = new EveryTickTask();
IndicatorTask indicatorTask = new IndicatorTask(this);
damageOverTimeTask = new DamageOverTimeTask(this);
particleTask = new ParticleTask();
energyRegenTask = new EnergyRegenTask(this);
regenTask = new RegenTask(this);
Expand Down Expand Up @@ -383,7 +389,7 @@ public void enable() {
));
taskList.add(strifeMobTracker.runTaskTimer(this,
20L * 61, // Start save after 1 minute
20L * 60 // Run every 1 minute after that
20L * 120 // Run every 2 minutes after that
));
taskList.add(saveTask.runTaskTimer(this,
20L * 680, // Start save after 11 minutes, 20 seconds cuz yolo
Expand All @@ -405,6 +411,10 @@ public void enable() {
11 * 20L, // Start timer after 11s
2L // Run it every 1/5th of a second after
));
taskList.add(damageOverTimeTask.runTaskTimer(this,
20L, // Start timer after 11s
5L // Run it every 5 ticks
));
taskList.add(bossBarsTask.runTaskTimer(this,
240L, // Start timer after 12s
2L // Run it every 1/10th of a second after
Expand All @@ -413,9 +423,9 @@ public void enable() {
220L, // Start timer after 11s
11L
));
taskList.add(globalMultiplierTask.runTaskTimer(this,
20L * 15, // Start timer after 15s
20L * 60 // Run it every minute after
taskList.add(boostTickTask.runTaskTimer(this,
20L,
20L
));
taskList.add(particleTask.runTaskTimer(this,
2L,
Expand Down Expand Up @@ -445,9 +455,14 @@ public void enable() {
3 * 20L + 2L, // Start timer after 3s
20L
));
taskList.add(Bukkit.getScheduler().runTaskTimer(this,
() -> boostManager.checkBoostSchedule(),
60L,
20L * 900
));

globalBoostManager.startScheduledEvents();
agilityManager.loadAgilityContainers();
boostManager.loadBoosts();

Bukkit.getPluginManager().registerEvents(new EndermanListener(), this);
Bukkit.getPluginManager().registerEvents(new ExperienceListener(this), this);
Expand Down Expand Up @@ -477,7 +492,8 @@ public void enable() {
Bukkit.getPluginManager().registerEvents(new FallListener(this), this);
Bukkit.getPluginManager().registerEvents(new LaunchAndLandListener(this), this);
Bukkit.getPluginManager().registerEvents(new DogeListener(strifeMobManager), this);
Bukkit.getPluginManager().registerEvents(new LoreAbilityListener(strifeMobManager, loreAbilityManager), this);
Bukkit.getPluginManager()
.registerEvents(new LoreAbilityListener(strifeMobManager, loreAbilityManager), this);
Bukkit.getPluginManager().registerEvents(new InventoryListener(this), this);
if (Bukkit.getPluginManager().getPlugin("Bullion") != null) {
Bukkit.getPluginManager().registerEvents(new BullionListener(this), this);
Expand All @@ -494,9 +510,11 @@ public void enable() {
menu.setId(menuId);

String name = abilityMenus.getString(menuId + ".name", "CONFIGURE ME");
List<String> lore = abilityMenus.getStringList(menuId + ".lore");
Material material = Material.valueOf(abilityMenus.getString(menuId + ".material", "BARRIER"));
int slot = abilityMenus.getInt(menuId + ".slot", 0);
AbilityPickerPickerItem subMenuIcon = new AbilityPickerPickerItem(menu, material, name, slot);
AbilityPickerPickerItem subMenuIcon = new AbilityPickerPickerItem(menu, material, name, lore,
slot);
pickerItems.add(subMenuIcon);
}

Expand Down Expand Up @@ -524,6 +542,7 @@ public void enable() {
@Override
public void disable() {
saveSpawners();
boostManager.saveBoosts();
storage.saveAll();

HandlerList.unregisterAll(this);
Expand Down Expand Up @@ -655,12 +674,12 @@ private void buildMobMods() {

private void loadScheduledBoosts() {
ConfigurationSection cs = globalBoostsYAML.getConfigurationSection("scheduled-boosts");
globalBoostManager.loadScheduledBoosts(cs);
boostManager.loadScheduledBoosts(cs);
}

private void loadBoosts() {
ConfigurationSection cs = globalBoostsYAML.getConfigurationSection("boost-templates");
globalBoostManager.loadStatBoosts(cs);
boostManager.loadStatBoosts(cs);
}

private void buildUniqueEnemies() {
Expand All @@ -686,7 +705,7 @@ private void buildUniqueEnemies() {
uniqueEntity.setDisplaceMultiplier(cs.getDouble("displace-multiplier", 1.0));
uniqueEntity.setExperienceMultiplier((float) cs.getDouble("experience-multiplier", 1));
uniqueEntity.setKnockbackImmune(cs.getBoolean("knockback-immune", false));
uniqueEntity.setCharmImmune(cs.getBoolean("charm-immune", true));
uniqueEntity.setCharmImmune(cs.getBoolean("charm-immune", false));
uniqueEntity.setBurnImmune(cs.getBoolean("burn-immune", false));
uniqueEntity.setFallImmune(cs.getBoolean("fall-immune", false));
uniqueEntity.setIgnoreSneak(cs.getBoolean("ignore-sneak", false));
Expand All @@ -701,6 +720,7 @@ private void buildUniqueEnemies() {
uniqueEntity.setSize(cs.getInt("size", -1));
uniqueEntity.getFactions().addAll(cs.getStringList("factions"));
uniqueEntity.setBaby(cs.getBoolean("baby", false));
uniqueEntity.setAngry(cs.getBoolean("angry", false));
uniqueEntity.setBaseLevel(cs.getInt("base-level", -1));

Disguise disguise = PlayerDataUtil.parseDisguise(cs.getConfigurationSection("disguise"),
Expand All @@ -717,6 +737,11 @@ private void buildUniqueEnemies() {
ConfigurationSection equipmentCS = cs.getConfigurationSection("equipment");
uniqueEntity.setEquipment(equipmentManager.buildEquipmentFromConfigSection(equipmentCS));

String passengerItem = cs.getString("item-passenger", "");
if (StringUtils.isNotBlank(passengerItem)) {
uniqueEntity.setItemPassenger(equipmentManager.getItem(passengerItem));
}

String particle = cs.getString("particle", "");
if (StringUtils.isNotBlank(particle)) {
Effect effect = effectManager.getEffect(particle);
Expand Down Expand Up @@ -885,8 +910,8 @@ public SpawnerManager getSpawnerManager() {
return spawnerManager;
}

public GlobalBoostManager getGlobalBoostManager() {
return globalBoostManager;
public BoostManager getBoostManager() {
return boostManager;
}

public SoulManager getSoulManager() {
Expand Down Expand Up @@ -977,6 +1002,10 @@ public EnergyRegenTask getEnergyRegenTask() {
return energyRegenTask;
}

public DamageOverTimeTask getDamageOverTimeTask() {
return damageOverTimeTask;
}

public RegenTask getRegenTask() {
return regenTask;
}
Expand Down
4 changes: 2 additions & 2 deletions src/main/java/land/face/strife/commands/StrifeCommand.java
Original file line number Diff line number Diff line change
Expand Up @@ -136,7 +136,7 @@ public void profileCommand(CommandSender sender, @Arg(name = "target") Player ta
@Command(identifier = "strife mobinfo", permissions = "strife.command.strife.info")
public void infoCommand(CommandSender sender) {
List<LivingEntity> targets = new ArrayList<>(
TargetingUtil.getEntitiesInLine((Player) sender, 30));
TargetingUtil.getEntitiesInLine(((Player) sender).getEyeLocation(), 30));
if (targets.isEmpty()) {
sendMessage(sender, "&eNo target found...");
return;
Expand Down Expand Up @@ -332,7 +332,7 @@ public void addXpCommand(CommandSender sender, @Arg(name = "target") Player play
@Command(identifier = "strife startBoost", permissions = "strife.command.strife.boosts", onlyPlayers = false)
public void startBoostCommand(CommandSender sender, @Arg(name = "boostId") String boostId,
@Arg(name = "creator") String creator, @Arg(name = "duration") int duration) {
boolean success = plugin.getGlobalBoostManager().createStatBoost(boostId, creator, duration);
boolean success = plugin.getBoostManager().startBoost(creator, boostId, duration);
if (!success) {
sendMessage(sender, "&cBoost with that ID doesn't exist, or this boost is running");
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,14 @@
import land.face.strife.util.DamageUtil.DamageScale;
import land.face.strife.util.DamageUtil.DamageType;

public class DamageContainer {
public class BonusDamage {

private DamageScale damageScale;
private DamageType damageType;
private StrifeStat damageStat;
private float amount;
private final DamageScale damageScale;
private final DamageType damageType;
private final StrifeStat damageStat;
private final float amount;

public DamageContainer(DamageScale damageScale, DamageType damageType,
public BonusDamage(DamageScale damageScale, DamageType damageType,
StrifeStat damageStat, float amount) {
this.damageScale = damageScale;
this.damageType = damageType;
Expand Down
44 changes: 44 additions & 0 deletions src/main/java/land/face/strife/data/Boost.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
package land.face.strife.data;

import java.util.Map;
import land.face.strife.stats.StrifeStat;

public class Boost {

private String boostId;
private int secondsRemaining;
private String boosterName;
private Map<StrifeStat, Float> stats;

public String getBoostId() {
return boostId;
}

public void setBoostId(String boostId) {
this.boostId = boostId;
}

public int getSecondsRemaining() {
return secondsRemaining;
}

public void setSecondsRemaining(int secondsRemaining) {
this.secondsRemaining = secondsRemaining;
}

public String getBoosterName() {
return boosterName;
}

public void setBoosterName(String boosterName) {
this.boosterName = boosterName;
}

public Map<StrifeStat, Float> getStats() {
return stats;
}

public void setStats(Map<StrifeStat, Float> stats) {
this.stats = stats;
}
}
Loading

0 comments on commit 2399745

Please sign in to comment.