Skip to content

Commit

Permalink
Merge pull request #37 from DeveloperDeborah/master
Browse files Browse the repository at this point in the history
bug fixes, more logging
  • Loading branch information
mortenn authored Jan 23, 2024
2 parents 56fd792 + 7b3c2b9 commit 0590fee
Show file tree
Hide file tree
Showing 4 changed files with 21 additions and 5 deletions.
1 change: 1 addition & 0 deletions src/defaults.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ eventMinTime: 2
eventMaxTime: 6
eventSteps: 7
baseDamage: 20.0
pickupDamage: 5.0
baseHealth: 200.0
healAmount: 30.0
antiDergonBubble:
Expand Down
7 changes: 7 additions & 0 deletions src/no/runsafe/dergons/Config.java
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ public void OnConfigurationChanged(IConfiguration config)
stepCount = config.getConfigValueAsInt("eventSteps");
minSpawnY = config.getConfigValueAsInt("spawnMinY");
baseDamage = config.getConfigValueAsFloat("baseDamage");
pickupDamage = config.getConfigValueAsFloat("pickupDamage");
baseHealth = config.getConfigValueAsFloat("baseHealth");
healAmount = config.getConfigValueAsFloat("healAmount");
spawnChance = config.getConfigValueAsInt("spawnChance");
Expand Down Expand Up @@ -86,6 +87,11 @@ public static float getBaseDamage()
return baseDamage;
}

public static float getPickupDamage()
{
return pickupDamage;
}

public static float getBaseHealth()
{
return baseHealth;
Expand Down Expand Up @@ -167,6 +173,7 @@ public void OnPluginEnabled()
private static int stepCount;
private static int minSpawnY;
private static float baseDamage;
private static float pickupDamage;
private static float baseHealth;
private static float healAmount;
private static int spawnChance;
Expand Down
4 changes: 2 additions & 2 deletions src/no/runsafe/dergons/Dergon.java
Original file line number Diff line number Diff line change
Expand Up @@ -174,7 +174,7 @@ private void attemptPlayerPickup()
chestplate.setDurability((short) (chestplate.getDurability() + 100));
unluckyChum.setChestplate(chestplate);
// Do additional damage
unluckyChum.damage(Config.getBaseDamage() / 2);
unluckyChum.damage(Config.getPickupDamage());
unluckyChum.addBuff(Buff.Combat.Blindness.duration(10));
unluckyChum.sendColouredMessage("&4You feel a darkness wash over you.");
}
Expand All @@ -185,7 +185,7 @@ else if (!(random.nextFloat() < 0.3F)) // If they're not flying and get lucky, a
if (rawChum == null)
return;

unluckyChum.damage(Config.getBaseDamage() / 4);
unluckyChum.damage(Config.getPickupDamage());
rawChum.startRiding(this);
ridingPlayer = unluckyChum;
handler.handleDergonMount(ridingPlayer);
Expand Down
14 changes: 11 additions & 3 deletions src/no/runsafe/dergons/EventMonitor.java
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ public boolean OnPlayerRightClick(IPlayer player, RunsafeMeta usingItem, IBlock
// Check if fireball was launched something other than a Dergon
IProjectileSource source = ((IAreaEffectCloud) entity).getSource();
Dergons.Debugger.debugFine("Area of effect source: " + source);
if (source instanceof IPlayer || source instanceof IBlockProjectileSource)
if (source != null)
continue;

// Make sure cloud isn't empty
Expand All @@ -89,7 +89,8 @@ public boolean OnPlayerRightClick(IPlayer player, RunsafeMeta usingItem, IBlock
if (cloud == null)
return true;

Dergons.Debugger.debugFine("Area Effect selected with radius: " + cloud.getRadius());
float cloudRadius = cloud.getRadius();
Dergons.Debugger.debugFine("Area Effect selected with radius: " + cloudRadius);
RunsafeInventory inventory = player.getInventory();
if (inventory.getContents().size() >= inventory.getSize())
{
Expand All @@ -103,7 +104,10 @@ public boolean OnPlayerRightClick(IPlayer player, RunsafeMeta usingItem, IBlock
inventory.addItems(item);
player.updateInventory();

cloud.setRadius(cloud.getRadius() - cloud.getRadiusOnUse());
if (cloudRadius < 0.25F)
cloud.setRadius(0);
else
cloud.setRadius(cloudRadius - 0.25F);
Dergons.Debugger.debugFine("Area Effect new radius: " + cloud.getRadius());
return false;
}
Expand All @@ -116,8 +120,12 @@ public void OnPlayerDeathEvent(RunsafePlayerDeathEvent event)

IEntity killer = event.getEntity().getKiller();
if (killer == null)
{
Dergons.Debugger.debugFine("Player %s killed by a null entity.", event.getEntity().getName());
return;
}

Dergons.Debugger.debugFine("Player %s killed by an entity with UUID: " + killer.getUniqueId(), event.getEntity().getName());
int dergonID = handler.healIfDergon(killer.getUniqueId());
if (dergonID <= 0)
return;
Expand Down

0 comments on commit 0590fee

Please sign in to comment.