-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #50 from jonathan-robertson/add-positive-boost
World Impact (Experiment)
- Loading branch information
Showing
9 changed files
with
134 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
using Amnesia.Utilities; | ||
using System; | ||
|
||
namespace Amnesia.Handlers { | ||
internal class EntityKilled { | ||
private static readonly ModLog log = new ModLog(typeof(EntityKilled)); | ||
|
||
internal static void Handle(Entity killedEntity, Entity killerEntity) { | ||
try { | ||
if (killerEntity.entityType != EntityType.Player) { return; } | ||
switch (killedEntity.GetDebugName()) { | ||
case "ZombieJuggernaut": | ||
TriggerKillAnnouncementAndBonus(killerEntity.GetDebugName(), "[ff8000]Juggernaut"); | ||
break; | ||
case "ZombieJuggernautGolden": | ||
TriggerKillAnnouncementAndBonus(killerEntity.GetDebugName(), "[ffff00]Golden Juggernaut"); | ||
break; | ||
} | ||
} catch (Exception e) { | ||
log.Error("HandleEntityKilled", e); | ||
} | ||
} | ||
|
||
internal static void TriggerKillAnnouncementAndBonus(string playerName, string zombieName) { | ||
MessagingSystem.Broadcast($"[007fff]{playerName} just killed a {zombieName}[007fff]!"); | ||
MessagingSystem.Broadcast($"[007fff]Relief washes over each survivor as a newfound confidence takes hold: [00ff80]all online players receive Double XP for 15 Minutes!"); | ||
GameManager.Instance.World.Players.list.ForEach(player => player.Buffs.AddBuff("triggerAmnesiaPositiveOutlookBoost")); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,57 @@ | ||
using System; | ||
using System.Collections.Generic; | ||
using System.Linq; | ||
|
||
namespace Amnesia.Utilities { | ||
internal class MessagingSystem { | ||
|
||
/** | ||
* <summary>Send a private message to a specific player.</summary> | ||
* <param name="message">The message to send.</param> | ||
* <param name="recipients">The player entityId(s) this message is addressed to.</param> | ||
*/ | ||
public static void Whisper(string message, params int[] recipients) { | ||
Send(EChatType.Whisper, message, recipients.ToList()); | ||
} | ||
|
||
/** | ||
* <summary>Send a private message to a specific player.</summary> | ||
* <param name="message">The message to send.</param> | ||
* <param name="recipients">The player entityId(s) this message is addressed to.</param> | ||
*/ | ||
public static void Whisper(string message, List<int> recipients) { | ||
Send(EChatType.Whisper, message, recipients); | ||
} | ||
|
||
/** | ||
* <summary>Send a message to all players.</summary> | ||
* <param name="message">The message to send.</param> | ||
*/ | ||
public static void Broadcast(string message) { | ||
Send(EChatType.Global, message, GameManager.Instance.World.Players.list.Select(p => p.entityId).ToList()); | ||
} | ||
|
||
/** | ||
* <summary>Send a message to all players who match the given condition.</summary> | ||
* <param name="message">The message to send.</param> | ||
* <param name="condition">The condition determining whether the player will receive the given message.</param> | ||
*/ | ||
public static void Broadcast(string message, Func<EntityPlayer, bool> condition) { | ||
Send(EChatType.Global, message, GameManager.Instance.World.Players.list | ||
.Where(condition) | ||
.Select(p => p.entityId) | ||
.ToList()); | ||
} | ||
|
||
private static void Send(EChatType chatType, string message, List<int> recipients) { | ||
GameManager.Instance.ChatMessageServer( | ||
_cInfo: null, | ||
_chatType: chatType, | ||
_senderEntityId: -1, | ||
_msg: message, | ||
_mainName: "", | ||
_localizeMain: false, | ||
_recipientEntityIds: recipients); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters