public void UpdatePsionicProperties() { var ParentsPsiMar = PsiHolder().GetPart <Psychomateriartis>(); var ParentsEgo = PsiHolder().Statistics["Ego"].Modifier; var ParentsLevel = PsiHolder().Statistics["Level"].BaseValue; var WeaponMeleeProps = ParentObject.GetPart <MeleeWeapon>(); var WeaponCurrency = ParentObject.GetIntProperty("Value"); SwingsRemaining = 100 * (ParentsEgo); ParentObject.SetIntProperty("Value", (int)Math.Min(1, WeaponCurrency * 0.1)); // WeaponMeleeProps.Ego = (int)Math.Floor(ParentsEgo * (ParentsPsiMar.Level * 0.1)); }
public override bool FireEvent(Event E) { if (E.ID == "EnteredCell") { //IPart.AddPlayerMessage(ParentObject.DisplayName+" fell on the ground."); if (ParentObject.HasProperty("LimbSourceGameObjectID") && ParentObject.HasProperty("LimbSourceBodyPartID")) { //IPart.AddPlayerMessage("it had properties!"); Cell cell = E.GetParameter("Cell") as Cell; GameObject parentO = GameObject.findById(ParentObject.GetStringProperty("LimbSourceGameObjectID")); if (parentO == null) { //IPart.AddPlayerMessage("not in cell!"); foreach (GameObject GO in dismeberees) { //IPart.AddPlayerMessage("are you my mummy("+ParentObject.GetStringProperty("LimbSourceGameObjectID")+")?"+GO.DisplayName+":"+GO.id); if (GO.id == ParentObject.GetStringProperty("LimbSourceGameObjectID")) { parentO = GO; } } } if (parentO != null) { //IPart.AddPlayerMessage("it had a parent!"); Body body = parentO.GetPart <Body>(); if (body != null) { //IPart.AddPlayerMessage("its parent had a body!"); Part = DeepCopy(body.GetPartByID(ParentObject.GetIntProperty("LimbSourceBodyPartID"), true)); } } } } return(base.FireEvent(E)); }
public override bool FireEvent(Event E) { if (E.ID == "AIGetOffensiveMutationList") { int intParameter = E.GetIntParameter("Distance"); GameObject gameObjectParameter = E.GetGameObjectParameter("Target"); List <AICommandList> list = (List <AICommandList>)E.GetParameter("List"); if (pActivatedAbility != null && !ParentObject.AreHostilesAdjacent() && pActivatedAbility.Cooldown <= 0 && intParameter > 3 && !ParentObject.AreHostilesAdjacent() && intParameter < 6 + ParentObject.GetIntProperty("LungeRangeModifier") && ParentObject.HasLOSTo(gameObjectParameter)) { List <Cell> list2 = PickLine(2, AllowVis.OnlyVisible); if (list2 == null) { return(true); } if (list2.Count != 2) { return(true); } for (int i = 0; i < list2.Count; i++) { foreach (GameObject item in list2[i].LoopObjectsWithPart("Combat")) { if (ParentObject.HasPart("Brain") && ParentObject.GetPart <Brain>().GetFeeling(item) >= 0) { return(true); } } } list.Add(new AICommandList("CommandAcegiakPolearmLunge", 1)); } return(true); } if (E.ID == "CommandAcegiakPolearmLunge") { if (!IsPrimaryPolearmEquipped()) { if (ParentObject.IsPlayer()) { Popup.Show("You must have a polearm equipped to Polearm Lunge."); } return(true); } if (ParentObject.OnWorldMap()) { if (ParentObject.IsPlayer()) { Popup.Show("You cannot Lunge on the world map."); } return(true); } if (ParentObject.pPhysics != null && ParentObject.pPhysics.IsFrozen()) { Popup.Show("You are frozen solid!"); return(true); } List <Cell> list3 = PickLine(2, AllowVis.OnlyVisible, ValidLungeTarget); if (list3 == null) { return(true); } int num = 3; int num2 = 2; if (list3.Count != num) { if (IsPlayer()) { Popup.Show("You must Lunge 2 spaces."); } return(false); } if (!list3[list3.Count - 1].HasObjectWithPart("Combat")) { if (IsPlayer()) { Popup.Show("You must Lunge at a target!"); } return(false); } Physics pPhysics = ParentObject.pPhysics; string text = ParentObject.pRender.ColorString + ParentObject.pRender.RenderString; if (ParentObject.IsPlayer()) { list3.RemoveAt(0); } int num3 = 10; foreach (Cell item2 in list3) { List <GameObject> objectsWithPart = item2.GetObjectsWithPart("Combat"); if (objectsWithPart.Count > 0) { if (objectsWithPart[0].IsPlayer()) { IPart.AddPlayerMessage("&R" + ParentObject.The + ParentObject.DisplayName + " &R" + ParentObject.GetVerb("lunge", PrependSpace: false) + " you!"); } if (ParentObject.DistanceTo(item2) == 2) { ParentObject.FireEvent(Event.New("CommandAttackCell", "Cell", item2, "Properties", "Lunging")); } pActivatedAbility.Cooldown = 0; ParentObject.FireEvent(Event.New("LungedTarget", "Defender", objectsWithPart[0])); objectsWithPart[0].FireEvent(Event.New("WasLunged", "Attacker", ParentObject)); return(true); } } } return(base.FireEvent(E)); }
public override bool FireEvent(Event E) { if (E.ID == "CommandApplyInjector") { // Exit if frozen if (!ParentObject.CheckFrozen()) { if (ParentObject.IsPlayer()) { Popup.Show("You are frozen!"); } return(false); } // get all injectors, or exit if none Body BodyObj = ParentObject.GetPart <Body>(); List <GameObject> Injectors = BodyObj == null ? null : BodyObj.GetEquippedObjects(InjectorFilter); if (Injectors == null || Injectors.Count == 0) { if (ParentObject.IsPlayer()) { Popup.Show("Equip at least one usable injector in a hand!"); } return(false); } // check if valid target Cell Cell = PickDirection(); if (Cell != null) { // Get all valid targets, respecting phasing/flying/light List <GameObject> Targets = Cell.GetObjectsWithPartReadonly("Brain"); // Remove hostile targets Targets.RemoveAll(T => T.pBrain.IsHostileTowards(ParentObject)); if (Targets.Count == 0) { if (ParentObject.IsPlayer()) { Popup.Show("No valid target!"); } return(false); } // We have a valid target! Check if in combat. GameObject Target = Targets[0]; foreach (GameObject Injector in Injectors) { if (Target.AreHostilesNearby()) // Make a attack against DV before injecting { // Lifted from Combat.cs int Roll = Stat.Random(1, 20); int BaseRoll = Roll; // we don't include movement bonuses in this roll since it's an ability activation Roll += ParentObject.GetIntProperty("HitBonus", 0); if (Injector != null) { Roll += Injector.GetIntProperty("HitBonus", 0); } int AgilityMod = ParentObject.StatMod("Agility"); Roll += AgilityMod; Event RollEvent = Event.New("RollMeleeToHit"); RollEvent.AddParameter("Weapon", Injector); RollEvent.AddParameter("Damage", 0); RollEvent.AddParameter("Defender", Target); RollEvent.AddParameter("Result", Roll); RollEvent.AddParameter("Skill", "ShortBlades"); RollEvent.AddParameter("Stat", "Agility"); Injector?.FireEvent(RollEvent); RollEvent.ID = "AttackerRollMeleeToHit"; Injector?.FireEvent(RollEvent); Roll = RollEvent.GetIntParameter("Result"); Event DVEvent = Event.New("GetDefenderDV"); DVEvent.AddParameter("Weapon", Injector); DVEvent.AddParameter("Damage", 0); DVEvent.AddParameter("Defender", Target); DVEvent.AddParameter("NaturalHitResult", BaseRoll); DVEvent.AddParameter("Result", Roll); DVEvent.AddParameter("Skill", "ShortBlades"); DVEvent.AddParameter("Stat", "Agility"); DVEvent.AddParameter("DV", Stats.GetCombatDV(Target)); Target.FireEvent(DVEvent); DVEvent.ID = "WeaponGetDefenderDV"; Injector?.FireEvent(DVEvent); // for masterwork mod, plus natural attacker/defender bonuses/penalties int NaturalHitBonus = 0; Event NaturalHitBonusEvent = Event.New("GetNaturalHitBonus", "Result", NaturalHitBonus); Injector.FireEvent(NaturalHitBonusEvent); NaturalHitBonusEvent.ID = "AttackerGetNaturalHitBonus"; ParentObject.FireEvent(NaturalHitBonusEvent); NaturalHitBonusEvent.ID = "DefenderGetNaturalHitBonus"; Target.FireEvent(NaturalHitBonusEvent); NaturalHitBonus = NaturalHitBonusEvent.GetIntParameter("Result"); if (BaseRoll + NaturalHitBonus < 20 && Roll <= DVEvent.GetIntParameter("DV")) // no autohit { // Chance to fumble, dropping the injector string Color = "&r"; int Diff = DVEvent.GetIntParameter("DV") - Roll; if (Stat.Random(1, 20) + AgilityMod <= Diff) { // fumble!!! if (ParentObject.IsPlayer()) { IPart.AddPlayerMessage(Color + "You miss, dropping the " + Injector.DisplayName + "!"); } ParentObject.FireEvent(Event.New("Unequipped", "UnequippingObject", Injector)); Event UnequipEvent = Event.New("PerformDrop", "Object", Injector); UnequipEvent.bSilent = E.bSilent; ParentObject.FireEvent(UnequipEvent); } else { if (ParentObject.IsPlayer()) { IPart.AddPlayerMessage(Color + "You miss with the " + Injector.DisplayName + "!"); } } continue; } } IPart.AddPlayerMessage("&gYou apply the " + Injector.DisplayName + " to " + Target.ShortDisplayName + "!"); // no hostiles or didn't miss - fire the injector Injector.FireEvent(Event.New("ApplyTonic", "Target", Target, "Attacker", ParentObject)); Injector.Destroy((string)null, false, false); } // Deal with energy cost - reduced by short blades skill int EnergyCost = 1000; if (ParentObject.HasSkill("ShortBlades_Expertise")) { EnergyCost = 750; } ParentObject.UseEnergy(EnergyCost, "Physical Skill"); return(true); } } return(false); }
public bool Kiss(GameObject who) { if (!hasPart(ParentObject, "face")) { if (who.IsPlayer()) { Popup.Show(ParentObject.The + ParentObject.DisplayNameOnlyDirect + "&y doesn't have a face."); } return(true); } if (!hasPart(who, "face")) { if (who.IsPlayer()) { Popup.Show("You don't have a face."); } return(true); } string beguiled = ""; string hbeguiled = " &Mkissed you back&y."; if (ParentObject.GetIntProperty("BeguilingBonusApplied") > 0) { beguiled = "\n" + ParentObject.It + ParentObject.GetVerb("quake") + " with fear and manic ecstasy."; hbeguiled = " could not resist."; } else { if (kissableIfPositiveFeeling && ParentObject.pBrain.GetFeeling(who) < 55) { if (who.IsPlayer()) { Popup.Show(ParentObject.The + ParentObject.DisplayNameOnlyDirect + "&y" + ParentObject.GetVerb("shy") + " away from you."); } ParentObject.pBrain.AdjustFeeling(who, -5); if (ParentObject.pBrain.GetFeeling(who) < 0) { Popup.Show(ParentObject.The + ParentObject.DisplayNameOnlyDirect + "&Y is upset by your advances!"); } return(true); } if (!isAttractedTo(who)) { if (who.IsPlayer()) { Popup.Show(ParentObject.The + ParentObject.DisplayNameOnlyDirect + "&Y isn't attracted to you."); } ParentObject.pBrain.AdjustFeeling(who, -10); if (ParentObject.pBrain.GetFeeling(who) < 0) { Popup.Show(ParentObject.The + ParentObject.DisplayNameOnlyDirect + "&Y is upset by your advances!"); } return(true); } } if (ParentObject.GetPart <acegiak_Romancable>() != null) { if (ParentObject.GetPart <acegiak_Romancable>().patience <= 0) { ParentObject.pBrain.AdjustFeeling(who, -5); Popup.Show(ParentObject.The + ParentObject.DisplayNameOnlyDirect + "&Y doesn't want to kiss you right now."); if (ParentObject.pBrain.GetFeeling(who) < 0) { Popup.Show(ParentObject.The + ParentObject.DisplayNameOnlyDirect + "&Y is upset by your advances!"); } } ParentObject.GetPart <acegiak_Romancable>().patience--; } string verb = "kiss"; GameObject parentObject = ParentObject; IPart.XDidYToZ(who, verb, parentObject, null, null, true); if (who.IsPlayer()) { if (ParentObject.HasPropertyOrTag("SpecialKissResponse")) { Popup.Show(ParentObject.GetTag("SpecialKissResponse")); } else { KissBuff(who); Popup.Show(ParentObject.The + ParentObject.DisplayNameOnlyDirect + "&y " + ParentObject.GetPropertyOrTag("KissResponse", "&Mkisses you back") + "." + beguiled); JournalAPI.AddAccomplishment("&y You kissed " + ParentObject.a + ParentObject.DisplayNameOnlyDirect + " and " + ParentObject.it + hbeguiled, "general", null, -1L); } } ParentObject.Heartspray(); who.UseEnergy(1000, "Kissing"); ParentObject.FireEvent(Event.New("ObjectKissed", "Object", ParentObject, "Kisser", who)); return(true); }