Ejemplo n.º 1
0
    // find PCs near

    public static GameObject fpn(int name, bool living_only = true, bool multiple = false)
    {
        foreach (var pc in ObjList.ListVicinity(SelectedPartyLeader.GetLocation(), ObjectListFilter.OLC_PC))
        {
            if ((pc.GetNameId() == name && !multiple))
            {
                return(pc);
            }
            else if (name == -1 | multiple)
            {
                if (living_only && pc.IsUnconscious())
                {
                    continue;
                }

                if (pc.GetNameId() != name && multiple)
                {
                    continue;
                }

                var(xx, yy) = pc.GetLocation();
                Logger.Info("{0}", pc + ",      name ID = " + pc.GetNameId() + ",    x = " + xx + ",    y = " + yy);
                pc.FloatMesFileLine("mes/test.mes", xx, TextFloaterColor.Red);
                pc.FloatMesFileLine("mes/test.mes", yy, TextFloaterColor.Red);
                return(pc);
            }
        }

        return(null);
    }
Ejemplo n.º 2
0
    // ------------------------------------------------------------------------------------------
    // @	@	@	@	@	@	@	@	@	@
    // ------------------------------------------------------------------------------------------

    public static GameObject s(int prot)
    {
        var(x, y) = SelectedPartyLeader.GetLocation();
        var a = spawn(prot, x, y + 1);

        return(a);
    }
Ejemplo n.º 3
0
    public static GameObject bsp(int prot)
    {
        var a = GameSystems.MapObject.CreateObject(prot, SelectedPartyLeader.GetLocation());

        a.ClearNpcFlag(NpcFlag.KOS);
        a.Move(SelectedPartyLeader.GetLocation(), 0, 0);
        return(a);
    }
Ejemplo n.º 4
0
    public override bool OnDying(GameObject attachee, GameObject triggerer)
    {
        SetGlobalVar(28, GetGlobalVar(28) + 1);
        if ((GetGlobalVar(28) >= 5))
        {
            GameSystems.MapObject.CreateObject(14330, SelectedPartyLeader.GetLocation());
        }

        return(RunDefault);
    }
Ejemplo n.º 5
0
 public static void killkos()
 {
     foreach (var moshe in ObjList.ListVicinity(SelectedPartyLeader.GetLocation(), ObjectListFilter.OLC_NPC))
     {
         if (((moshe.GetNpcFlags() & NpcFlag.KOS) != 0 && (moshe.GetNpcFlags() & NpcFlag.KOS_OVERRIDE) == 0 && moshe.GetScriptId(ObjScriptEvent.WillKos) == 0 && moshe.GetLeader() == null))
         {
             var damage_dice = Dice.Parse("50d50");
             moshe.Damage(PartyLeader, DamageType.Bludgeoning, damage_dice);
         }
     }
 }
Ejemplo n.º 6
0
 // Kill unfriendlies
 public static void kuf(int c_name)
 {
     foreach (var moshe in ObjList.ListVicinity(SelectedPartyLeader.GetLocation(), ObjectListFilter.OLC_NPC))
     {
         if ((moshe.GetReaction(PartyLeader) <= 0 || !moshe.IsFriendly(PartyLeader)) && (!((GameSystems.Party.PartyMembers).Contains(moshe.GetLeader())) && (moshe.GetObjectFlags() & ObjectFlag.DONTDRAW) == 0) && (moshe.GetNameId() == c_name || c_name == -1))
         {
             // moshe.critter_kill_by_effect()
             var damage_dice = Dice.Parse("50d50");
             moshe.Damage(PartyLeader, DamageType.Bludgeoning, damage_dice);
         }
     }
 }
Ejemplo n.º 7
0
 // Kill unfriendlies
 public static void kuf(string c_name)
 {
     foreach (var moshe in ObjList.ListVicinity(SelectedPartyLeader.GetLocation(), ObjectListFilter.OLC_NPC))
     {
         var name = GameSystems.MapObject.GetDisplayName(moshe);
         if ((moshe.GetReaction(PartyLeader) <= 0 || !moshe.IsFriendly(PartyLeader)) && (!((GameSystems.Party.PartyMembers).Contains(moshe.GetLeader())) && (moshe.GetObjectFlags() & ObjectFlag.DONTDRAW) == 0) && name.Contains(c_name, StringComparison.CurrentCultureIgnoreCase))
         {
             // moshe.critter_kill_by_effect()
             var damage_dice = Dice.Parse("50d50");
             moshe.Damage(PartyLeader, DamageType.Bludgeoning, damage_dice);
         }
     }
 }
Ejemplo n.º 8
0
    public override bool OnExitCombat(GameObject attachee, GameObject triggerer)
    {
        if ((attachee.GetStat(Stat.subdual_damage) >= attachee.GetStat(Stat.hp_current)))
        {
            SetGlobalVar(28, GetGlobalVar(28) + 1);
            if ((GetGlobalVar(28) >= 5))
            {
                GameSystems.MapObject.CreateObject(14330, SelectedPartyLeader.GetLocation());
            }
        }

        return(RunDefault);
    }
Ejemplo n.º 9
0
    public static GameObject fpn(string name)
    {
        foreach (var pc in ObjList.ListVicinity(SelectedPartyLeader.GetLocation(), ObjectListFilter.OLC_PC))
        {
            var pcName = GameSystems.MapObject.GetDisplayName(pc);
            if (pcName.Contains(name, StringComparison.CurrentCultureIgnoreCase))
            {
                return(pc);
            }
        }

        return(null);
    }
Ejemplo n.º 10
0
    public static List <GameObject> vlist3(int radius)
    {
        var gladius = new List <GameObject>();

        foreach (var moshe in ObjList.ListVicinity(SelectedPartyLeader.GetLocation(), ObjectListFilter.OLC_NPC))
        {
            if (moshe.DistanceTo(PartyLeader) <= radius)
            {
                gladius.Add(moshe);
            }
        }

        return(gladius);
    }
Ejemplo n.º 11
0
    // AI tester, optionally select different proto (default - troll)

    public static GameObject tai(int strat, int prot = 14262)
    {
        // def tai(strat, prot = 14262): # AI tester, optionally select different proto (default - troll)
        SetGlobalFlag(403, true); // Test mode flag
        var(xx, yy) = SelectedPartyLeader.GetLocation();
        // prot = 14262
        int y   = yy + 3;
        var tro = GameSystems.MapObject.CreateObject(prot, new locXY(xx + 3, y));

        tro.SetScriptId(ObjScriptEvent.StartCombat, 3);
        tro.SetInt(obj_f.critter_strategy, strat);
        tro.SetBaseStat(Stat.hp_max, 300); // so he doesn't die from AoOs too quickly
        return(tro);
    }
Ejemplo n.º 12
0
    // Test Spiritual Weapon Thingamajig

    public static GameObject tsw()
    {
        // def tsw():	# Test Spiritual Weapon Thingamajig
        SetGlobalFlag(403, true); // Test mode flag
        var(xx, yy) = SelectedPartyLeader.GetLocation();
        // prot = 14262
        int y   = yy + 3;
        var tro = GameSystems.MapObject.CreateObject(14262, new locXY(xx + 3, y));

        // tro.scripts[15] = 998 # py00998test_combat.py
        tro.SetInt(obj_f.critter_strategy, 99); // strategy
        tro.SetBaseStat(Stat.hp_max, 300);      // so he doesn't die from AoOs too quickly
        return(tro);
    }
Ejemplo n.º 13
0
    public static List <GameObject> vlist(List <int> npc_names)
    {
        using var moshe = ObjList.ListVicinity(SelectedPartyLeader.GetLocation(), ObjectListFilter.OLC_NPC);
        var return_list = new List <GameObject>();

        foreach (var obj in moshe)
        {
            if (npc_names.Contains(obj.GetNameId()))
            {
                return_list.Add(obj);
            }
        }

        return(return_list);
    }
Ejemplo n.º 14
0
    public override bool OnDying(GameObject attachee, GameObject triggerer)
    {
        if (CombatStandardRoutines.should_modify_CR(attachee))
        {
            CombatStandardRoutines.modify_CR(attachee, CombatStandardRoutines.get_av_level());
        }

        SetGlobalVar(28, GetGlobalVar(28) + 1);
        if ((GetGlobalVar(28) >= 5))
        {
            GameSystems.MapObject.CreateObject(14330, SelectedPartyLeader.GetLocation());
        }

        return(RunDefault);
    }
Ejemplo n.º 15
0
    public static List <(int, int, int)> nxy(int radius)
    {
        var gladius = new List <(int, int, int)>();

        foreach (var moshe in ObjList.ListVicinity(SelectedPartyLeader.GetLocation(), ObjectListFilter.OLC_NPC))
        {
            if (moshe.DistanceTo(PartyLeader) <= radius)
            {
                var(x, y) = moshe.GetLocation();
                gladius.Add((moshe.GetNameId(), x, y));
            }
        }

        return(gladius);
    }
Ejemplo n.º 16
0
    // AI tester, by proto, optionally alter strategy

    public static GameObject ptai(int prot, int strat)
    {
        // def ptai(prot, strat = -999): # AI tester, by proto, optionally alter strategy
        SetGlobalFlag(403, true); // Test mode flag
        var(xx, yy) = SelectedPartyLeader.GetLocation();
        int y   = yy + 3;
        var tro = GameSystems.MapObject.CreateObject(prot, new locXY(xx + 3, y));

        // tro.scripts[15] = 0
        if (strat != -999)
        {
            tro.SetInt(obj_f.critter_strategy, 99 + strat);
        }

        tro.SetBaseStat(Stat.hp_max, 300);
        return(tro);
    }
Ejemplo n.º 17
0
    public static List <ValueTuple <int, string, int, int> > tgd(int hp_desired, int radius)
    {
        // tough guy detector
        // returns a list of critters with HP greater than [hp_desired]
        // list includes the critters "name" , HP, and XY coordinates
        var gladius = new List <ValueTuple <int, string, int, int> >();

        foreach (var moshe in ObjList.ListVicinity(SelectedPartyLeader.GetLocation(), ObjectListFilter.OLC_NPC))
        {
            if (moshe.DistanceTo(PartyLeader) <= radius && moshe.GetStat(Stat.hp_max) >= hp_desired)
            {
                var(x, y) = moshe.GetLocation();
                gladius.Add((moshe.GetNameId(), "hp=" + moshe.GetStat(Stat.hp_max), x, y));
            }
        }

        return(gladius);
    }
Ejemplo n.º 18
0
    public static void follower(int proto_num)
    {
        var npc = GameSystems.MapObject.CreateObject(proto_num, SelectedPartyLeader.GetLocation());

        if (!(SelectedPartyLeader.HasMaxFollowers()))
        {
            SelectedPartyLeader.AddFollower(npc);
        }
        else
        {
            SelectedPartyLeader.AddAIFollower(npc);
        }

        // add familiar_obj to d20initiative, and set initiative to spell_caster's
        var caster_init_value = SelectedPartyLeader.GetInitiative();

        npc.AddToInitiative();
        npc.SetInitiative(caster_init_value);
        UiSystems.Combat.Initiative.UpdateIfNeeded();
    }
Ejemplo n.º 19
0
    public static List <GameObject> vlist(int npc_name)
    {
        using var moshe = ObjList.ListVicinity(SelectedPartyLeader.GetLocation(), ObjectListFilter.OLC_NPC);
        if (npc_name != -1)
        {
            var return_list = new List <GameObject>();
            foreach (var obj in moshe)
            {
                if (npc_name == obj.GetNameId())
                {
                    return_list.Add(obj);
                }
            }

            return(return_list);
        }
        else
        {
            return(new List <GameObject>(moshe));
        }
    }
Ejemplo n.º 20
0
    public static void kf()
    {
        // Kill foes
        foreach (var moshe in ObjList.ListVicinity(SelectedPartyLeader.GetLocation(), ObjectListFilter.OLC_NPC))
        {
            var hostile = 0;
            foreach (var pc in GameSystems.Party.PartyMembers)
            {
                if (moshe.GetReaction(pc) <= 0)
                {
                    hostile = 1;
                }
            }

            if ((hostile == 1 && moshe.GetLeader() == null))
            {
                // moshe.critter_kill_by_effect()
                var damage_dice = Dice.Parse("50d50");
                moshe.Damage(PartyLeader, DamageType.Bludgeoning, damage_dice);
            }
        }
    }
Ejemplo n.º 21
0
    public static GameObject fnn(int name = -1, bool living_only = true, bool multiple = false)
    {
        var got_one = 0;

        foreach (var npc in ObjList.ListVicinity(SelectedPartyLeader.GetLocation(), ObjectListFilter.OLC_NPC))
        {
            if ((npc.GetNameId() == name && !multiple))
            {
                return(npc);
            }
            else if (name == -1 | multiple)
            {
                if (living_only && npc.IsUnconscious())
                {
                    continue;
                }

                if (npc.GetNameId() != name && multiple)
                {
                    continue;
                }

                got_one     = 1;
                var(xx, yy) = npc.GetLocation();
                Logger.Info("{0}", npc + ",      name ID = " + npc.GetNameId() + ",    x = " + xx + ",    y = " + yy);
                npc.FloatMesFileLine("mes/test.mes", xx, TextFloaterColor.Red);
                npc.FloatMesFileLine("mes/test.mes", yy, TextFloaterColor.Red);
            }
        }

        if (got_one == 0 && name == -1 && living_only)
        {
            fnn(living_only: false);
        }

        return(null);
    }
Ejemplo n.º 22
0
 public static List <GameObject> vlist()
 {
     using var moshe = ObjList.ListVicinity(SelectedPartyLeader.GetLocation(), ObjectListFilter.OLC_NPC);
     return(new List <GameObject>(moshe));
 }
Ejemplo n.º 23
0
    public static int trail_check()
    {
        // returned number, meaning
        // 1 - has attack dog companion
        // 2 - has wolf companion
        // 3 - has jackal companion
        // 50 - made successful listen check
        // 60 - spotted tracks, but no tracking feat
        // 65 - spotted tracks, got tracking feat
        // look for canine animal companions
        foreach (var pc in GameSystems.Party.PartyMembers)
        {
            if ((pc.HasFeat(FeatId.ANIMAL_COMPANION)))
            {
                foreach (var npc in ObjList.ListVicinity(SelectedPartyLeader.GetLocation(), ObjectListFilter.OLC_NPC))
                {
                    if ((is_canine_companion(npc) > 0 && npc.GetLeader() != null))
                    {
                        var abcd = is_canine_companion(npc);
                        return(abcd);
                    }
                }
            }
        }

        // failing that, make listen check
        var listen_chk = RandomRange(1, 20);
        var highest_listen_modifier = 0;

        foreach (var obj in GameSystems.Party.PartyMembers)
        {
            if ((obj.GetSkillLevel(SkillId.listen) > highest_listen_modifier))
            {
                listen_chk = RandomRange(1, 20);
                if ((listen_chk + obj.GetSkillLevel(SkillId.listen) >= 20))
                {
                    return(50);
                }
            }
        }

        // failing that, the traders got away while you were searching (and looking away); but after a while you find their tracks
        // if you have the tracking feat, you can follow the tracks; otherwise it's all over in Hommlet
        var spot_highest = 0;

        foreach (var obj in GameSystems.Party.PartyMembers)
        {
            var spot_chk = RandomRange(1, 20);
            if ((spot_chk + obj.GetSkillLevel(SkillId.spot) >= spot_highest))
            {
                spot_highest = spot_chk + obj.GetSkillLevel(SkillId.spot);
            }
        }

        if ((spot_highest >= 20))
        {
            foreach (var pc in GameSystems.Party.PartyMembers)
            {
                if ((pc.HasFeat(FeatId.TRACK)))
                {
                    return(65);
                }
            }

            return(60);
        }

        return(0);
    }