some champs fixes/balance

duplicate message improvement
This commit is contained in:
Cheese 2015-06-20 15:00:16 +10:00
parent 77bf332c29
commit 478a3c8591
5 changed files with 64 additions and 13 deletions

View File

@ -20,4 +20,38 @@ public class UtilText
return out;
}
public static boolean isStringSimilar(String newString, String oldString, float matchRequirement)
{
for (int i=0 ; i < newString.length() * matchRequirement ; i++)
{
int matchFromIndex = 0;
//Look for substrings starting at i
for (int j=0 ; j < oldString.length() ; j++)
{
//End of newString
if (i+j > newString.length())
{
break;
}
//Matched
if (newString.charAt(i+j) == oldString.charAt(j))
{
matchFromIndex++;
if (matchFromIndex >= newString.length() * matchRequirement)
return true;
}
//No Match > Reset
else
{
break;
}
}
}
return false;
}
}

View File

@ -33,6 +33,7 @@ import mineplex.core.common.util.C;
import mineplex.core.common.util.F;
import mineplex.core.common.util.UtilPlayer;
import mineplex.core.common.util.UtilServer;
import mineplex.core.common.util.UtilText;
import mineplex.core.common.util.UtilTime;
import org.bukkit.entity.Player;
@ -341,9 +342,9 @@ public class Chat extends MiniPlugin
event.setCancelled(true);
}
else if (!_clientManager.Get(sender).GetRank().Has(Rank.MODERATOR) &&
lastMessage.getMessage().equalsIgnoreCase(event.getMessage()))
UtilText.isStringSimilar(event.getMessage(), lastMessage.getMessage(), 0.8f))
{
UtilPlayer.message(sender, F.main("Chat", "You can't repeat the same message."));
UtilPlayer.message(sender, F.main("Chat", "This message is too similar to your previous message."));
event.setCancelled(true);
}
}
@ -354,7 +355,8 @@ public class Chat extends MiniPlugin
private boolean msgContainsHack(String msg)
{
msg = msg.toLowerCase();
msg = " " + msg.toLowerCase() + " ";
msg.replaceAll("[^a-zA-Z ]", " ");
return (msg.contains(" hack ") ||
msg.contains(" hacker ") ||

View File

@ -20,6 +20,7 @@ import mineplex.minecraft.game.core.damage.CustomDamageEvent;
import mineplex.core.common.util.F;
import mineplex.core.updater.event.UpdateEvent;
import mineplex.core.updater.UpdateType;
import mineplex.core.visibility.VisibilityManager;
import mineplex.core.common.util.NautHashMap;
import mineplex.core.common.util.UtilAction;
import mineplex.core.common.util.UtilBlock;
@ -211,6 +212,10 @@ public class DwarfToss extends SkillActive
UtilPlayer.message(player, F.main(GetClassType().name(), "You picked up " + F.name(UtilEnt.getName(target)) + " with " + F.skill(GetName(level)) + "."));
UtilPlayer.message(target, F.main(GetClassType().name(), F.name(player.getName()) + " grabbed you with " + F.skill(GetName(level)) + "."));
//Hide!
if (target instanceof Player)
VisibilityManager.Instance.setVisibility((Player)target, false, player);
//Event
UtilServer.getServer().getPluginManager().callEvent(new SkillEvent(player, GetName(), ClassType.Brute, target));
@ -301,6 +306,10 @@ public class DwarfToss extends SkillActive
int level = getLevel(cur);
UtilPlayer.message(cur, F.main(GetClassType().name(), F.name(UtilEnt.getName(target)) + " escaped your " + F.skill(GetName(level)) + "."));
//Show!
if (target instanceof Player)
VisibilityManager.Instance.setVisibility((Player)target, true, cur);
}
for (final Player cur : throwSet)
@ -316,6 +325,10 @@ public class DwarfToss extends SkillActive
timeScale = Math.max(0.25, ((double)time/(double)_chargeTime));
}
//Show!
if (target instanceof Player)
VisibilityManager.Instance.setVisibility((Player)target, true, cur);
//Throw
cur.eject();
target.leaveVehicle();
@ -335,8 +348,7 @@ public class DwarfToss extends SkillActive
//Effect
target.playEffect(EntityEffect.HURT);
}
}, 4);
}, 5);
//Inform
UtilPlayer.message(cur, F.main(GetClassType().name(), "You threw " + F.name(UtilEnt.getName(target)) + " with " + F.skill(GetName(level)) + "."));
@ -350,13 +362,19 @@ public class DwarfToss extends SkillActive
player.eject();
player.leaveVehicle();
for (Player cur : _holding.keySet())
{
if (_holding.get(cur).equals(player))
if (cur.equals(player) || _holding.get(cur).equals(player))
{
cur.eject();
_holding.remove(cur);
LivingEntity target = _holding.remove(cur);
_time.remove(cur);
//Show!
if (target instanceof Player)
VisibilityManager.Instance.setVisibility((Player)target, true, cur);
}
}

View File

@ -151,7 +151,7 @@ public class SeismicSlam extends SkillActive
//Velocity
UtilAction.velocity(cur,
UtilAlg.getTrajectory2d(player.getLocation().toVector(), cur.getLocation().toVector()),
0.2 + 1.6 * targets.get(cur), true, 0, 0.2 + 1.2 * targets.get(cur), 1.6, true);
0.4 + 2 * targets.get(cur), true, 0, 0.2 + 1.2 * targets.get(cur), 1.6, true);
//Condition
Factory.Condition().Factory().Falling(GetName(), cur, player, 10, false, true);

View File

@ -63,6 +63,7 @@ import mineplex.core.itemstack.ItemStackFactory;
import mineplex.core.recharge.Recharge;
import mineplex.core.updater.UpdateType;
import mineplex.core.updater.event.UpdateEvent;
import mineplex.core.visibility.VisibilityManager;
import mineplex.minecraft.game.core.combat.event.CombatDeathEvent;
import mineplex.minecraft.game.core.damage.CustomDamageEvent;
import nautilus.game.arcade.ArcadeManager;
@ -1197,11 +1198,7 @@ public class SurvivalGamesTeams extends TeamGame
return;
for (Player player : GetPlayers(true))
for (Player other : GetPlayers(true))
{
player.hidePlayer(other);
player.showPlayer(other);
}
VisibilityManager.Instance.refreshPlayerToAll(player);
Announce(C.cRed + C.Bold + "Deathmatch in " + _deathmatchTime + "...");
_deathmatchTime--;