Skip to content

Commit

Permalink
Merge pull request #12 from MDdev0/feature-changes-1.1
Browse files Browse the repository at this point in the history
Entering Beta 1.1!
  • Loading branch information
MDdev0 authored Jan 5, 2024
2 parents 3ecfd23 + f681df3 commit a98f296
Show file tree
Hide file tree
Showing 34 changed files with 557 additions and 304 deletions.
126 changes: 63 additions & 63 deletions README.md

Large diffs are not rendered by default.

14 changes: 9 additions & 5 deletions config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,10 @@ hardcoreStyle: true
# If true, players in spectator mode will not be able to send messages to chat. Operators bypass this.
blockSpectatorChat: true

# If true, spectating players will appear to leave the game when they die and will be hidden from the tab list when online.
# Remember to set the game rule to hide player death messages if true!
hideDeadPlayers: false

# Amount of time in seconds players will be considered as "attacking" after attempting to kill someone
attackDuration: 30

Expand All @@ -28,15 +32,15 @@ peripheralsRange: 10
rescueRange: 8.0

# Cost (in levels) to trigger Scatter
scatterCost: 5
scatterCost: 4
# Cost (in levels) to trigger Toadify
toadifyCost: 15
toadifyCost: 4
# Cost (in levels) to trigger Fog of War
fogOfWarCost: 10
fogOfWarCost: 8
# Effective range of Fog of War
fogOfWarRange: 30
# Cost (in levels) to trigger Vanish
vanishCost: 10
vanishCost: 8

# Number of targets hunters will be given
hunterNumTargets: 3
Expand All @@ -50,7 +54,7 @@ requiredRoles:
- "REANIMATOR"
- "INVESTIGATOR"
- "APOTHECARY"
- "DEACON"
- "PRIEST"
- "SERIAL_KILLER"
- "HUNTER"

Expand Down
4 changes: 2 additions & 2 deletions plugin.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
name: MafiaCraft
main: mddev0.mafiacraft.MafiaCraft
version: 1.1
api-version: 1.19
version: b1.1.0
api-version: 1.20
depend: [ProtocolLib]
commands:
mafiacraftadmin:
Expand Down
8 changes: 4 additions & 4 deletions src/mddev0/mafiacraft/MafiaCraft.java
Original file line number Diff line number Diff line change
Expand Up @@ -60,9 +60,9 @@ public void onEnable() {
Bukkit.getPluginManager().registerEvents(new Protection(this), this);
Bukkit.getPluginManager().registerEvents(new Succession(this), this);
Bukkit.getPluginManager().registerEvents(new Forgery(this), this);
Bukkit.getPluginManager().registerEvents(new Assassination(this), this);
Bukkit.getPluginManager().registerEvents(new Reanimation(this), this);
Bukkit.getPluginManager().registerEvents(new Retaliation(this), this);
Bukkit.getPluginManager().registerEvents(new Assassinate(this), this);
Bukkit.getPluginManager().registerEvents(new Revive(this), this);
Bukkit.getPluginManager().registerEvents(new Retaliate(this), this);
abilityHighNoon.runTaskTimer(this, 0L, 1L); // checks every tick
Bukkit.getPluginManager().registerEvents(new Marksman(this), this);
Bukkit.getPluginManager().registerEvents(new Investigate(this), this);
Expand All @@ -72,7 +72,7 @@ public void onEnable() {
Bukkit.getPluginManager().registerEvents(new Rescue(this), this);
abilityAmbrosia.runTaskTimer(this, 0L, 100L); // checks every 5 seconds
Bukkit.getPluginManager().registerEvents(abilityAmbrosia, this);
abilityInquisition.runTaskTimer(this, 0L, 600L); // show particles every 10 seconds
abilityInquisition.runTaskTimer(this, 0L, 200L); // show particles every 10 seconds
Bukkit.getPluginManager().registerEvents(new Ambush(this), this);
Bukkit.getPluginManager().registerEvents(new ThisIsFine(this), this);
Bukkit.getPluginManager().registerEvents(new DodgeRoll(this), this);
Expand Down
114 changes: 79 additions & 35 deletions src/mddev0/mafiacraft/abilities/Ability.java
Original file line number Diff line number Diff line change
Expand Up @@ -2,47 +2,91 @@

@SuppressWarnings("unused")
public enum Ability {
PROTECTION("Protection"),
CHARISMA("Charisma"), // Has no class
SUCCESSION("Succession"),
FORGERY("Forgery"),
ASSASSINATION("Assassination"),
REANIMATION("Reanimation"),
RETALIATION("Retaliation"),
HIGH_NOON("High Noon"),
MARKSMAN("Marksman"),
INVESTIGATE("Investigate"),
WATCH("Watch"),
PERIPHERALS("Peripherals"),
CLEAR_SIGHT("Clear Sight"),
RESCUE("Rescue"),
AMBROSIA("Ambrosia"),
INQUISITION("Inquisition"),
AMBUSH("Ambush"),
THIS_IS_FINE("This is Fine"),
DODGE_ROLL("Dodge Roll"),
TARGET("Target"), // Has no class
TRACKING("Tracking"), // Has no class
SPELL_BOOK("Spell Book"),
SCATTER("Scatter"),
TOADIFY("Toadify"),
FOG_OF_WAR("Fog of War"),
VANISH("Vanish"),
TRANSFORM("Transform"),
RAMPAGE("Rampage"),
NEMESIS("Nemesis"),
CONVERT("Convert"),
NIGHT_OWL("Night Owl"),
STAKED("Staked"),
JUST_A_PRANK("Just a Prank");
PROTECTION("Protection",
"When attacked first, receive Resistance II for 30 seconds."),
CHARISMA("Charisma",
"Appear innocent to Investigators, despite being a member of the Mafia."), // Has no class
SUCCESSION("Succession",
"When the Godfather dies, one Mafioso will be selected at random to become the new Godfather."),
FORGERY("Forgery",
"Drop a paper named 'Forgery' on a player to make them appear suspicious to Investigators. Resets at the end of the in-game day."),
ASSASSINATE("Assassinate",
"When attacking first, gains Strength I and Speed I for 60 seconds."),
REVIVE("Revive",
"Throw a Totem of Undying into a soul flame. Then, choose a dead player to resurrect."),
RETALIATE("Retaliate",
"When attacked first, receive Strength II and Resistance II for 30 seconds."),
HIGH_NOON("High Noon",
"Receive Strength II for 60 seconds at noon of the in-game day."),
MARKSMAN("Marksman",
"Arrows do one additional heart of damage."),
INVESTIGATE("Investigate",
"Use a spyglass to spy on a player for 10 seconds to learn if they are suspected of being in the Mafia."),
WATCH("Watch",
"Can see invisible players when using a Spyglass."),
PERIPHERALS("Peripherals",
"Can see invisible players within 20 blocks."),
CLEAR_SIGHT("Clear Sight",
"Not affected by Blindness or Darkness."),
RESCUE("Rescue",
"If a player (other than you), would otherwise die within 16 blocks of you, they will be placed at 0.5 hearts and receive Regeneration III for 15 seconds."),
AMBROSIA("Ambrosia",
"Brew a special potion by throwing a Golden Apple, Bottle of Honey, and Bucket of Milk into a heated cauldron."),
INQUISITION("Inquisition",
"Any player who has is using or has recently used any magical ability will display a subtle particle effect to Priests."),
AMBUSH("Ambush",
"When attacking first, gains Strength II for 30 seconds."),
PROTECTEE("Protectee",
"Assigned one player to protect at the beginning of the game."), // Has no class
THIS_IS_FINE("This is Fine",
"Take reduced damage from fire and lava."),
DODGE_ROLL("Dodge Roll",
"Take significantly less damage from explosions and fall damage."),
TARGET("Target",
"Receive a list at the beginning of the game of targets."), // Has no class
TRACKING("Tracking",
"See whether your targets or protectee are dead or alive."), // Has no class
SPELL_BOOK("Spell Book",
"Craft a spell book by throwing any enchanted book into normal fire. Use to switch spells."),
SCATTER("Scatter",
"Grant one person Speed IV for 20 seconds. Costs 5 levels of experience."),
TOADIFY("Toadify",
"Inflict one person with Slowness V and Jump Boost V for 15 seconds. Costs 5 levels of experience."),
FOG_OF_WAR("Fog of War",
"Inflict everyone within 30 blocks with Blindness I for 30 seconds. Costs 10 levels of experience."),
VANISH("Vanish",
"Grant one person Invisibility for 3 minutes. Costs 10 levels of experience."),
SHADOW_PLEDGE("Shadow Pledge",
"At the beginning of the game, you are randomly assigned alignment with the Village or Mafia. You win with this team, but they do not know this."), // Has no class
TRANSFORM("Transform",
"Transform on full-moon nights."),
RAMPAGE("Rampage",
"For every kill while Transformed, gain one level of strength for the rest of the night (maximum Strength V)."),
NEMESIS("Nemesis",
"Weak to Iron Tools while Transformed."),
CONVERT("Convert",
"All kills will not permanently kill the player, instead they will respawn as a Vampire."),
NIGHT_OWL("Night Owl",
"Affected by Weakness II during the day."),
STAKED("Staked",
"Weak to Wooden Tools."),
JUST_A_PRANK("Just a Prank",
"Be killed by a member of the Village without fighting back to respawn.");

private final String NAME;

Ability(String name) {
private final String DESCRIPTION;

Ability(String name, String desc) {
this.NAME = name;
this.DESCRIPTION = desc;
}

public String fullName() {
public String toString() {
return NAME;
}

public String getDesc() {
return DESCRIPTION;
}
}
12 changes: 6 additions & 6 deletions src/mddev0/mafiacraft/abilities/Ambrosia.java
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,10 @@ public void run() {
if (b.getType() == Material.WATER_CAULDRON) {
// check block below
if (i.getLocation().add(0, -1, 0).getBlock().getType() == Material.FIRE ||
i.getLocation().add(0, -1, 0).getBlock().getType() == Material.SOUL_FIRE) {
i.getLocation().add(0, -1, 0).getBlock().getType() == Material.SOUL_FIRE ||
i.getLocation().add(0, -1, 0).getBlock().getType() == Material.CAMPFIRE ||
i.getLocation().add(0, -1, 0).getBlock().getType() == Material.SOUL_CAMPFIRE ||
i.getLocation().add(0, -1, 0).getBlock().getType() == Material.LAVA) {
// Check cauldron level
Levelled bdata = (Levelled) b.getBlockData();
if (bdata.getLevel() == bdata.getMaximumLevel()) {
Expand Down Expand Up @@ -80,16 +83,14 @@ public void run() {
ambrosiaPotion.setColor(Color.fromRGB(255,200,0));
ambrosiaPotion.setDisplayName(ChatColor.GOLD + "Ambrosia");
List<String> ambrosiaLore = new ArrayList<>();
ambrosiaLore.add("Splash on any " + ChatColor.DARK_RED + "Werewolf" +
ChatColor.RESET + " or " + ChatColor.DARK_PURPLE + "Vampire");
ambrosiaLore.add("Splash on any " + ChatColor.DARK_PURPLE + "Vampire");
ambrosiaLore.add("to convert them back to their original role.");
ambrosiaPotion.setLore(ambrosiaLore);
ambrosiaItem.setItemMeta(ambrosiaPotion);
Item spawned = (Item) i.getWorld().spawnEntity(b.getLocation(), EntityType.DROPPED_ITEM);
spawned.setItemStack(ambrosiaItem);
// Add cooldown to thrower
long waitUntil = plugin.getWorldFullTime() + (24000L * 7); // 7 days later
waitUntil = waitUntil - (waitUntil % 24000); // Round to earliest morning
long waitUntil = plugin.getWorldFullTime() + 864000L; // 12 real hours later
thrower.getCooldowns().startCooldown(Ability.AMBROSIA, waitUntil);
thrower.getStatus().startStatus(StatusData.Status.UNHOLY, plugin.getWorldFullTime() + 48000L); // Two days of unholy
}
Expand All @@ -102,7 +103,6 @@ public void run() {
}
}

// TODO: Make this take werewolves out of transformation?
// When potion lands
@EventHandler
public void onPotionLand(PotionSplashEvent splash) {
Expand Down
4 changes: 2 additions & 2 deletions src/mddev0/mafiacraft/abilities/Ambush.java
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,8 @@ public void onAttackPlayer(EntityDamageByEntityEvent damage) {
if (damager != null) {
// Only take action if not null
if (damagerMP.getRole().getAbilities().contains(Ability.AMBUSH) && !damagerMP.getCooldowns().isOnCooldown(Ability.AMBUSH)) {
damager.addPotionEffect(new PotionEffect(PotionEffectType.INCREASE_DAMAGE, 600, 1, false, false, true));
long waitUntil = plugin.getWorldFullTime() + 24000L;
damager.addPotionEffect(new PotionEffect(PotionEffectType.INCREASE_DAMAGE, 1200, 1, false, false, true));
long waitUntil = plugin.getWorldFullTime() + 24000L * 3;
waitUntil = waitUntil - (waitUntil % 24000);
damagerMP.getCooldowns().startCooldown(Ability.AMBUSH, waitUntil);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,11 @@
import org.bukkit.potion.PotionEffect;
import org.bukkit.potion.PotionEffectType;

public final class Assassination implements Listener {
public final class Assassinate implements Listener {

private final MafiaCraft plugin;

public Assassination(MafiaCraft plugin) {
public Assassinate(MafiaCraft plugin) {
this.plugin = plugin;
}

Expand All @@ -31,12 +31,12 @@ public void onAttackPlayer(EntityDamageByEntityEvent damage) {
if (damager != null) {
// Only take action if not null
MafiaPlayer attacker = plugin.getLivingPlayers().get(damager.getUniqueId());
if (attacker != null && attacker.getRole().getAbilities().contains(Ability.ASSASSINATION) && !attacker.getCooldowns().isOnCooldown(Ability.ASSASSINATION)) {
damager.addPotionEffect(new PotionEffect(PotionEffectType.INCREASE_DAMAGE, 1200, 0, false, false, true));
damager.addPotionEffect(new PotionEffect(PotionEffectType.SPEED, 1200, 0, false, false, true));
long waitUntil = plugin.getWorldFullTime() + 24000L;
if (attacker != null && attacker.getRole().getAbilities().contains(Ability.ASSASSINATE) && !attacker.getCooldowns().isOnCooldown(Ability.ASSASSINATE)) {
damager.addPotionEffect(new PotionEffect(PotionEffectType.INCREASE_DAMAGE, 2400, 0, false, false, true));
damager.addPotionEffect(new PotionEffect(PotionEffectType.SPEED, 2400, 0, false, false, true));
long waitUntil = plugin.getWorldFullTime() + 24000L * 3;
waitUntil = waitUntil - (waitUntil % 24000);
attacker.getCooldowns().startCooldown(Ability.ASSASSINATION, waitUntil);
attacker.getCooldowns().startCooldown(Ability.ASSASSINATE, waitUntil);
}
}
}
Expand Down
12 changes: 6 additions & 6 deletions src/mddev0/mafiacraft/abilities/ClearSight.java
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,6 @@
import org.bukkit.event.entity.EntityPotionEffectEvent;
import org.bukkit.potion.PotionEffectType;

import java.util.Objects;

public final class ClearSight implements Listener {

private final MafiaCraft plugin;
Expand All @@ -20,12 +18,14 @@ public ClearSight(MafiaCraft plugin) {

@SuppressWarnings("unused")
@EventHandler
public void onBlindnessApplied(EntityPotionEffectEvent potion) {
public void onEffectApplied(EntityPotionEffectEvent potion) {
if (!plugin.getActive()) return; // DO NOTHING IF NOT ACTIVE!
MafiaPlayer affected = plugin.getPlayerList().get(potion.getEntity().getUniqueId());
if (potion.getEntity().getType() == EntityType.PLAYER && affected != null &&
affected.getRole().getAbilities().contains(Ability.CLEAR_SIGHT) &&
Objects.requireNonNull(potion.getNewEffect()).getType() == PotionEffectType.BLINDNESS)
if (potion.getEntity().getType() == EntityType.PLAYER && affected != null && potion.getNewEffect() != null &&
affected.getRole().getAbilities().contains(Ability.CLEAR_SIGHT) && (
potion.getNewEffect().getType() == PotionEffectType.BLINDNESS ||
potion.getNewEffect().getType() == PotionEffectType.DARKNESS
))
potion.setCancelled(true); // Cancel potion effect if eligible player is being blinded
}
}
2 changes: 1 addition & 1 deletion src/mddev0/mafiacraft/abilities/HighNoon.java
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ public void run() {
if (p.getValue().getRole().getAbilities().contains(Ability.HIGH_NOON)) {
Player affected = Bukkit.getPlayer(p.getKey());
if (affected != null && affected.isOnline()) {
affected.addPotionEffect(new PotionEffect(PotionEffectType.INCREASE_DAMAGE, 1200, 1, false, false, true));
affected.addPotionEffect(new PotionEffect(PotionEffectType.INCREASE_DAMAGE, 600, 1, false, false, true));
}
}
}
Expand Down
4 changes: 2 additions & 2 deletions src/mddev0/mafiacraft/abilities/Inquisition.java
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,8 @@ public void run() {
if (target.getValue().getStatus().hasStatus(StatusData.Status.UNHOLY)) {
Player t = Bukkit.getPlayer(target.getKey());
assert t != null;
s.spawnParticle(Particle.TOWN_AURA, t.getLocation().add(0,1,0), 20, 1, 1, 1);
s.spawnParticle(Particle.SCULK_SOUL, t.getLocation().add(0,1,0), 2, 2, 2, 2);
s.spawnParticle(Particle.TOWN_AURA, t.getLocation().add(0,1,0), 15, 0.7, 0.7, 0.7, 0.0);
s.spawnParticle(Particle.SCULK_SOUL, t.getLocation().add(0,1,0), 2, 1.5, 1.5, 1.5, 0.0);
}
}
}
Expand Down
Loading

0 comments on commit a98f296

Please sign in to comment.