/// <summary> /// The instigating character locks up the receiving character. /// </summary> public static GameState LockUpCharacter(GameState state, Character instigator, Character receiver, Item item) { GameState newState = state.Clone(); // May not be an actual guard, but this needed a variable name that wasn't "lockerUpper" var guard = newState.GetCharacter(instigator.Name); var prisoner = newState.GetCharacter(receiver.Name); if (guard != null && prisoner != null) { prisoner.RemoveStatus("Mobile"); // TODO (kasiu): Add some more/better lines? newState.AddLine(instigator.Name, new DialogueLine(instigator.Name, "Stay locked up in there!")); } return(newState); }
/// <summary> /// The instigating character steals an item from the receiving character. /// One of the preconditions should be that the receiving character has the item. /// </summary> public static GameState StealItemFromCharacter(GameState state, Character instigator, Character receiver, Item item) { GameState newState = state.Clone(); var thief = newState.GetCharacter(instigator.Name); var victim = newState.GetCharacter(receiver.Name); // Nothing should happen if for some reason the game state is mucked up. if (thief != null && victim != null && victim.HasItem(item)) { victim.Items.Remove(item); thief.Items.Add(item); newState.AddLine(thief.Name, new DialogueLine(thief.Name, "Success! This " + item.Name + " is mine!")); newState.AddLine(victim.Name, new DialogueLine(victim.Name, "Wait...where did the " + item.Name + " go?")); } return(newState); }
/// <summary> /// The instgating character gives the receiving character an item. /// </summary> public static GameState GiveCharacterItem(GameState state, Character instigator, Character receiver, Item item) { GameState newState = state.Clone(); var giver = newState.GetCharacter(instigator.Name); var given = newState.GetCharacter(receiver.Name); // Obligatory null checks. if (giver != null && given != null && giver.HasItem(item)) { giver.Items.Remove(item); given.Items.Add(item); newState.AddLine(giver.Name, new DialogueLine(giver.Name, "Here you go.")); newState.AddLine(given.Name, new DialogueLine(receiver.Name, "Hey thanks for the " + item.Name + ".")); } return(newState); }
/// <summary> /// Returns whether or not the receiving character is alive. /// Makes use of optional parameters on the condition. /// </summary> public static bool IsReceiverAlive(GameState state, Character instigator, Character receiver, Item item = null) { Character character = null; if (receiver != null) { character = state.GetCharacter(receiver.Name); } return((character != null) && character.IsAlive()); }
/// <summary> /// The instigating character chooses to wait. The state is unchanged. /// </summary> public static GameState Wait(GameState state, Character instigator, Character receiver, Item item) { GameState newState = state.Clone(); if (newState.GetCharacter(instigator.Name) != null) { newState.AddLine(instigator.Name, new DialogueLine(instigator.Name, "I guess I can do nothing but wait.")); } return(newState); }
/// <summary> /// The instigating character insults the receiving character, lowering trust/like of the receiver for the instigator. /// </summary> public static GameState InsultCharacter(GameState state, Character instigator, Character receiver, Item item) { GameState newState = state.Clone(); var jerk = newState.GetCharacter(instigator.Name); var insultee = newState.GetCharacter(receiver.Name); if (jerk != null && insultee != null) { // HACK (kasiu): SOMEONE THINK OF A BETTER INSULT TO PUT HERE. newState.AddLine(jerk.Name, new DialogueLine(jerk.Name, "You know " + insultee.Name + ", you're an asshole.")); newState.AddLine(insultee.Name, new DialogueLine(insultee.Name, "What? You try saying that again!")); var oldFeelings = insultee.GetRelationship(jerk.Name); var newFeelings = new feelingsAboutChar(); // Lowers trust and like by -1 newFeelings.Trust = Math.Max(oldFeelings.Trust - 1, -2); newFeelings.Like = Math.Max(oldFeelings.Like - 1, -2); insultee.ChangeRelationship(jerk.Name, newFeelings); } return(newState); }
/// <summary> /// The instigating character finds the item lying around the environment. /// </summary> public static GameState FindItem(GameState state, Character instigator, Character receiver, Item item) { GameState newState = state.Clone(); var finder = newState.GetCharacter(instigator.Name); if (finder != null && newState.Items.Contains(item)) { newState.Items.Remove(item); finder.Items.Add(item); newState.AddLine(finder.Name, new DialogueLine(finder.Name, "Well look here! I found a " + item.Name)); } return(newState); }
/// <summary> /// The instigating character frees him/her/itself with a liberating item. /// </summary> public static GameState FreeCharacterWithItem(GameState state, Character instigator, Character receiver, Item item) { GameState newState = state.Clone(); var liberated = newState.GetCharacter(instigator.Name); var libIndex = newState.Characters.FindIndex(c => c.Name == instigator.Name); if (liberated != null && liberated.HasItem(item)) { liberated.Items.Remove(item); newState.AddLine(liberated.Name, new DialogueLine(liberated.Name, "I'm free, thanks!")); newState.Characters[libIndex] = liberated; } return(newState); }
/// <summary> /// The instigating character steals an item from the receiving character. /// One of the preconditions should be that the receiving character has the item. /// This is the benign version of STEALING. /// </summary> public static GameState TakeItemFromPlayer(GameState state, Character instigator, Character receiver, Item item) { GameState newState = state.Clone(); var thief = newState.GetCharacter(instigator.Name); var thiefIndex = newState.Characters.FindIndex(c => c.Name == instigator.Name); // Nothing should happen if for some reason the game state is mucked up. if (thief != null && item != null) { newState.Player.RemoveItem(item); thief.Items.Add(item); newState.AddLine(thief.Name, new DialogueLine(thief.Name, "Great! Thanks for getting that for me!")); newState.Characters[thiefIndex] = thief; } return(newState); }
/// <summary> /// Introduces an escape quest. /// </summary> /// <returns></returns> public static GameState IntroduceEscapeQuest(GameState state, Character instigator, Character receiver, Item item) { GameState newState = state.Clone(); if (instigator != null && receiver != null) { Location loc = DramaManager.Instance.GetNewItemLocation(state, instigator); var escapee = newState.GetCharacter(instigator.Name); escapee.Hidden = false; Item key = new Item(instigator.Name + "Item" + "Liberating", loc.X, loc.Y); newState.AddItem(key); key.AddStatus("Liberating"); key.SetHidden(false); Random r = new Random(); //if (r.Next(0, 2) == 0) { // key.AddStatus("Distance"); //} //newState.Player.AddStatus(instigator.Name + "Wants" + key.Name); newState.Player.AddStatus("Knows" + instigator.Name); if (instigator.Name.Contains(DramaManager.PRISONER_TITLE)) { newState.AddLine(instigator.Name, new DialogueLine(instigator.Name, "Hey buddy, not sure who you are, but I need this thing.")); newState.AddLine(instigator.Name, new DialogueLine(instigator.Name, "I need to try and get out of this place. I'll make it worth your while.")); } else if (instigator.Name.Contains(DramaManager.GUARD_TITLE)) { newState.AddLine(instigator.Name, new DialogueLine(instigator.Name, "Entity, I require your assistance.")); newState.AddLine(instigator.Name, new DialogueLine(instigator.Name, "One of these monsters wishes to escape. Fetch me the device they desire and I'll reward you.")); } } return(newState); }
/// <summary> /// Returns whether or not the receiving character has a "mobile" status (i.e. can move). /// Makes use of optional parameters on the condition. /// </summary> public static bool IsReceiverMobile(GameState state, Character instigator, Character receiver, Item item = null) { var character = state.GetCharacter(receiver.Name); return (character != null) && character.HasStatus("Mobile"); }
/// <summary> /// Returns whether or not the receiving character is dead. /// Makes use of optional parameters on the condition. /// </summary> public static bool IsReceiverDead(GameState state, Character instigator, Character receiver, Item item = null) { var character = state.GetCharacter(receiver.Name); return (character != null) && !character.IsAlive(); }
/// <summary> /// Returns whether or not the receiving character is alive. /// Makes use of optional parameters on the condition. /// </summary> public static bool IsReceiverAlive(GameState state, Character instigator, Character receiver, Item item = null) { Character character = null; if(receiver!=null){ character = state.GetCharacter(receiver.Name); } return(character != null) && character.IsAlive() ; }
/// <summary> /// Returns whether or not the instigating character like the receiving character. /// Makes use of optional parameters on the condition. /// </summary> public static bool DoesInstigatorLikeReceiver(GameState state, Character instigator, Character receiver, Item item = null) { var character = state.GetCharacter(instigator.Name); return((character != null) ? (character.GetRelationship(receiver.Name).Like > 0) : false); }
/// <summary> /// Returns whether or not the receiving character has a "mobile" status (i.e. can move). /// Makes use of optional parameters on the condition. /// </summary> public static bool IsReceiverMobile(GameState state, Character instigator, Character receiver, Item item = null) { var character = state.GetCharacter(receiver.Name); return((character != null) && character.HasStatus("Mobile")); }
/// <summary> /// Returns whether or not the receiving character is dead. /// Makes use of optional parameters on the condition. /// </summary> public static bool IsReceiverDead(GameState state, Character instigator, Character receiver, Item item = null) { var character = state.GetCharacter(receiver.Name); return((character != null) && !character.IsAlive()); }
/// <summary> /// Returns whether or not the instigating character like the receiving character. /// Makes use of optional parameters on the condition. /// </summary> public static bool DoesInstigatorLikeReceiver(GameState state, Character instigator, Character receiver, Item item = null) { var character = state.GetCharacter(instigator.Name); return (character != null) ? (character.GetRelationship(receiver.Name).Like > 0) : false; }
// NOTE (kasiu): The following four functions use the "IsAlive" method found in Character.cs. // This is a shorthand method due to the fact that we check the "alive" status in // other modules, but is not something we should do for other character stasuses. // For conditions that rely on other attributes or statuses, please us "HasStatus" // with the appropriate string instead. /// <summary> /// Returns whether or not the instigating character is alive. /// Makes use of optional parameters on the condition. /// </summary> public static bool IsInstigatorAlive(GameState state, Character instigator, Character receiver = null, Item item = null) { var character = state.GetCharacter(instigator.Name); return (character != null) && character.IsAlive() ; }
// NOTE (kasiu): The following four functions use the "IsAlive" method found in Character.cs. // This is a shorthand method due to the fact that we check the "alive" status in // other modules, but is not something we should do for other character stasuses. // For conditions that rely on other attributes or statuses, please us "HasStatus" // with the appropriate string instead. /// <summary> /// Returns whether or not the instigating character is alive. /// Makes use of optional parameters on the condition. /// </summary> public static bool IsInstigatorAlive(GameState state, Character instigator, Character receiver = null, Item item = null) { var character = state.GetCharacter(instigator.Name); return((character != null) && character.IsAlive()); }