Example #1
0
        public override void Update(Task caller)
        {
            base.Update(caller);

            // Add related Person or Foe resource
            if (personSymbol != null && !string.IsNullOrEmpty(personSymbol.Name))
            {
                Person person = ParentQuest.GetPerson(personSymbol);
                if (person != null)
                {
                    DaggerfallUI.Instance.DaggerfallHUD.EscortingFaces.AddFace(person);
                }
            }
            else if (foeSymbol != null && !string.IsNullOrEmpty(foeSymbol.Name))
            {
                Foe foe = ParentQuest.GetFoe(foeSymbol);
                if (foe != null)
                {
                    DaggerfallUI.Instance.DaggerfallHUD.EscortingFaces.AddFace(foe);
                }
            }

            // Popup saying message
            if (sayingID != 0)
            {
                ParentQuest.ShowMessagePopup(sayingID);
            }

            SetComplete();
        }
Example #2
0
 void Start()
 {
     f = GetComponent <Foe>();
     p = Player.instance;
     StartCoroutine(NormalSkillCoroutine());
     StartCoroutine(UltimateSkillCoroutine());
 }
Example #3
0
        private int CalculateNpcHitPoints(IBattle battleNpc)
        {
            int battleNpcHitPoints = 0;

            if (battleNpc is Foe /*playerHitPoints >= battleNpcHitPoints*/)
            {
                Foe battlingNpc = _currentNpc as Foe;


                switch (NpcBattleResponse())
                {
                case BattleModeName.ATTACK:
                    battleNpcHitPoints = battleNpc.Attack();

                    break;

                case BattleModeName.DEFEND:
                    battleNpcHitPoints = battleNpc.Defend();

                    break;

                case BattleModeName.RETREAT:
                    battleNpcHitPoints = battleNpc.Retreat();
                    break;
                }
            }
            return(battleNpcHitPoints);
        }
        private static List <Foe> GetUniqueFoes()
        {
            // we have 3,4 or 5 stars
            // we have 6 types of foes
            // we have 2 types of Elite (yes and no)

            // for each combo of star
            List <Foe> uniqueFoes = new List <Foe>();

            for (int star = 3; star <= 5; star++)
            {
                for (int foetype = 0; foetype < 6; foetype++)
                {
                    for (int elite = 0; elite < 2; elite++)
                    {
                        Foe f = new Foe();
                        f.Stars = (StarName)star;
                        f.Type  = (FoeType)foetype;
                        f.Elite = elite == 0 ? false : true;
                        uniqueFoes.Add(f);
                    }
                }
            }
            return(uniqueFoes);
        }
 public FoeFighter(Foe foe, string foeName, string foughtBy)
 {
     Foe      = foe;
     FoeName  = foeName;
     FoughtBy = foughtBy;
     Hexes    = new List <HexType>();
 }
 public FoeFighter(Foe foe, string foeName, List <HexType> hexes, string foughtBy)
 {
     Foe      = foe;
     FoeName  = foeName;
     FoughtBy = foughtBy;
     Hexes    = hexes;
 }
Example #7
0
        public static Boolean testCollision(Object obj1, BoundingBox obj2)
        {
            // On réalise le mvt dans une bounding box de test et on renvoie le résultat de l'intersection avec l'objet obj
            Vector3 upperLeftCorner   = new Vector3(0, 0, 0);
            Vector3 bottomRightCorner = new Vector3(0, 0, 0);

            if (obj1 is Doctor)
            {
                Doctor who = (Doctor)obj1;
                upperLeftCorner.X   = who.Position.X + who.Velocity.X;
                upperLeftCorner.Y   = who.Position.Y + who.Velocity.Y;
                bottomRightCorner.X = who.Position.X + who.FrameSize.X + who.Velocity.X;
                bottomRightCorner.Y = who.Position.Y + who.FrameSize.Y + who.Velocity.Y;
            }

            if (obj1 is Foe)
            {
                Foe killer = (Foe)obj1;
                upperLeftCorner.X   = killer.Position.X + killer.Velocity.X;
                upperLeftCorner.Y   = killer.Position.Y + killer.Velocity.Y;
                bottomRightCorner.X = killer.Position.X + killer.FrameSize.X + killer.Velocity.X;
                bottomRightCorner.Y = killer.Position.Y + killer.FrameSize.Y + killer.Velocity.Y;
            }

            BoundingBox bbox_test = new BoundingBox(upperLeftCorner, bottomRightCorner);

            return(bbox_test.Intersects(obj2));
        }
Example #8
0
        public override void Update(Task caller)
        {
            base.Update(caller);

            // Create SiteLink if not already present
            if (!QuestMachine.HasSiteLink(ParentQuest, placeSymbol))
            {
                QuestMachine.CreateSiteLink(ParentQuest, placeSymbol);
            }

            // Attempt to get Foe resource
            Foe foe = ParentQuest.GetFoe(foeSymbol);

            if (foe == null)
            {
                SetComplete();
                throw new Exception(string.Format("Could not find Foe resource symbol {0}", foeSymbol));
            }

            // Attempt to get Place resource
            Place place = ParentQuest.GetPlace(placeSymbol);

            if (place == null)
            {
                SetComplete();
                throw new Exception(string.Format("Could not find Place resource symbol {0}", placeSymbol));
            }

            // Assign Foe to Place
            place.AssignQuestResource(foeSymbol, marker);

            SetComplete();
        }
    // Makes a copy of the current foe
    public Foe copy()
    {
        Foe clone = new Foe(dude, stats, skillList, skillOdds, skillTargetAI, drops, dropRate, hurtbox, gravity);

        if (dude != "")
        {
            clone.setAnimations(this.face, this.idle, this.idleAct, this.confused, this.walk, this.hurt);
        }
        return(clone);
    }
Example #10
0
        private void buttonAddNevid_Click(object sender, EventArgs e)
        {
            listGroup.BeginUpdate();
            var foe = new Foe();

            if (!listGroup.Items.Contains(foe))
            {
                listGroup.Items.Add(foe);
                listGroup.ManualSort();
            }

            listGroup.EndUpdate();
        }
Example #11
0
    IEnumerator UpdateCoroutine()
    {
        Foe f = GetComponent <Foe>();

        while (true)
        {
            f.hp       += f.hpmax / 8f;
            speedScale += 0.25f;
            if (f.hp > f.hpmax)
            {
                f.hp = f.hpmax;
            }
            yield return(new WaitForSeconds(9.99f));
        }
    }
Example #12
0
        public override void Update(Task caller)
        {
            // Get related Foe resource
            Foe foe = ParentQuest.GetFoe(foeSymbol);

            if (foe == null)
            {
                return;
            }

            // Raise the restrained flag
            foe.SetRestrained();

            SetComplete();
        }
        FaceDetails CreateFaceDetails(Foe foe)
        {
            UnityEngine.Random.InitState(Time.frameCount);

            FaceDetails face = new FaceDetails();

            face.questUID         = foe.ParentQuest.UID;
            face.targetFoe        = foe.Symbol;
            face.targetRace       = Races.Breton;
            face.gender           = foe.Gender;
            face.faceIndex        = UnityEngine.Random.Range(0, faceCount);
            face.factionFaceIndex = -1;

            return(face);
        }
Example #14
0
        public override void Update(Task caller)
        {
            base.Update(caller);

            // Attempt to get Foe resource
            Foe foe = ParentQuest.GetFoe(foeSymbol);

            if (foe == null)
            {
                SetComplete();
                throw new Exception(string.Format("Could not find Foe resource symbol {0}", foeSymbol));
            }

            foe.IsHidden = true;
            SetComplete();
        }
Example #15
0
        public override bool CheckTrigger(Task caller)
        {
            // Get related Foe resource
            Foe foe = ParentQuest.GetFoe(foeSymbol);

            if (foe == null)
            {
                return(false);
            }

            // Check injured flag
            if (foe.InjuredTrigger)
            {
                return(true);
            }

            return(false);
        }
Example #16
0
        public override bool CheckTrigger(Task caller)
        {
            // Get related Foe resource
            Foe foe = ParentQuest.GetFoe(foeSymbol);
            if (foe == null)
                return false;

            // Check total kills recorded on this Foe
            if (foe.KillCount >= killsRequired)
            {
                // Popup saying message
                if (sayingID != 0)
                    ParentQuest.ShowMessagePopup(sayingID);

                return true;
            }

            return false;
        }
Example #17
0
        public FormSostavMain(string members)
        {
            InitializeComponent();

            var par = members.Split(new[] { ';' }, StringSplitOptions.RemoveEmptyEntries);

            listGroup.BeginUpdate();
            for (var t = 0; t < par.Length; t++)
            {
                var foe = new Foe(par[t]);
                if (!foe.IsValid)
                {
                    continue;
                }
                listGroup.Items.Add(foe);
            }

            listGroup.ManualSort();
            listGroup.EndUpdate();
        }
Example #18
0
        public FormSostav(string sostav)
        {
            InitializeComponent();

            if (!string.IsNullOrEmpty(sostav))
            {
                listGroup.BeginUpdate();
                var par = sostav.Split(new[] { ';' }, StringSplitOptions.RemoveEmptyEntries);
                for (var i = 0; i < par.Length; i++)
                {
                    var foe = new Foe(par[i]);
                    if (!foe.IsValid)
                    {
                        continue;
                    }
                    if (!listGroup.Items.Contains(foe))
                    {
                        listGroup.Items.Add(foe);
                    }

                    listGroup.ManualSort();
                    listGroup.EndUpdate();
                }
            }

            comboTriba.SelectedIndex = 0;

            comboMinLevel.BeginUpdate();
            comboMaxLevel.BeginUpdate();
            for (var i = 0; i <= 33; i++)
            {
                comboMinLevel.Items.Add(i);
                comboMaxLevel.Items.Add(i);
            }

            comboMinLevel.EndUpdate();
            comboMaxLevel.EndUpdate();
            comboMinLevel.SelectedIndex = 0;
            comboMaxLevel.SelectedIndex = 33;
        }
Example #19
0
    // Use this for initialization
    void Start()
    {
        projectiles = new List <GameObject>();
        party       = TitleManager.curFile.getParty();
        curDude     = party[0];
        for (int i = 0; i < party.Count; i++)
        {
            if (party[i].getCharacter() == character.ANNIE)
            {
                annie = party[i];
                break;
            }
        }

        // Make the bag enemy
        int[]    theStats = { 0, 0, 0, theBag.def, 0, theBag.mdef, 0 };
        Sprite[] idleBag  = new Sprite[1];
        Sprite[] hurtBag  = new Sprite[1];
        idleBag[0] = theBag.ok;
        hurtBag[0] = theBag.hurt;
        SpriteAnimation idle = new SpriteAnimation(idleBag, new int[0], 0, true);
        SpriteAnimation hurt = new SpriteAnimation(hurtBag, new int[0], 0, true);

        mrsBag = new Foe("Mrs. Bag", theStats, new List <Skill>(), new int[0],
                         new AItype[0], new Item[0], new int[0], theBag.hurtbox, 3f);
        mrsBag.setAnimations(null, idle, idle, idle, idle, hurt);

        ResetFighters();
        b3time = 0;

        // Hide menu
        textDisplay(mainOpts, false);
        textDisplay(skills, false);
        textDisplay(skillInfo, false);
        textDisplay(tips, false);
        description.enabled = false;
        answer.enabled      = false;
        menuScreen.GetComponent <SpriteRenderer>().enabled = false;
    }
        /// <summary>
        /// Adds a single quest foe to marker position.
        /// </summary>
        static void AddQuestFoe(SiteTypes siteType, Quest quest, QuestMarker marker, Foe foe, Transform parent)
        {
            // Create enemy GameObject
            Vector3    dungeonBlockPosition = new Vector3(marker.dungeonX * RDBLayout.RDBSide, 0, marker.dungeonZ * RDBLayout.RDBSide);
            GameObject go = CreateEnemy("Quest Foe", foe.FoeType, dungeonBlockPosition + marker.flatPosition, parent);

            // Add QuestResourceBehaviour to GameObject
            QuestResourceBehaviour questResourceBehaviour = go.AddComponent <QuestResourceBehaviour>();

            questResourceBehaviour.AssignResource(foe);

            // Set QuestResourceBehaviour in this particular instantiated Foe object
            // Each GameObject placed in world for this Foe will reference same Foe quest resource
            // Keep this one-to-many relationship in mind for Foe handling
            foe.QuestResourceBehaviour = questResourceBehaviour;

            // Rearm injured trigger at time of placement
            // Notes for later:
            //  * This should be rearmed at the beginning of each wave
            //  * Only first wounding of a wave will trigger "injured aFoe" until rearmed on next wave
            foe.RearmInjured();
        }
Example #21
0
        private void buttonAddGroup_Click(object sender, EventArgs e)
        {
            var triba = (string)comboTriba.SelectedItem;
            var min   = comboMinLevel.SelectedIndex;
            var max   = comboMaxLevel.SelectedIndex;

            listGroup.BeginUpdate();
            for (var level = min; level <= max; level++)
            {
                var foe = new Foe(triba, level, "");
                if (!foe.IsValid)
                {
                    continue;
                }
                if (!listGroup.Items.Contains(foe))
                {
                    listGroup.Items.Add(foe);
                }
            }

            listGroup.ManualSort();
            listGroup.EndUpdate();
        }
Example #22
0
        public override bool CheckTrigger(Task caller)
        {
            // Get related Foe resource
            Foe foe = ParentQuest.GetFoe(foeSymbol);

            if (foe == null)
            {
                return(false);
            }

            // Check injured flag
            if (foe.InjuredTrigger)
            {
                // Optionally show message
                if (textID != 0)
                {
                    ParentQuest.ShowMessagePopup(textID);
                }

                return(true);
            }

            return(false);
        }
Example #23
0
        public override void Update(Task caller)
        {
            base.Update(caller);

            // Drop related Person or Foe resource
            if (personSymbol != null && !string.IsNullOrEmpty(personSymbol.Name))
            {
                Person person = ParentQuest.GetPerson(personSymbol);
                if (person != null)
                {
                    DaggerfallUI.Instance.DaggerfallHUD.EscortingFaces.DropFace(person);
                }
            }
            else if (foeSymbol != null && !string.IsNullOrEmpty(foeSymbol.Name))
            {
                Foe foe = ParentQuest.GetFoe(foeSymbol);
                if (foe != null)
                {
                    DaggerfallUI.Instance.DaggerfallHUD.EscortingFaces.DropFace(foe);
                }
            }

            SetComplete();
        }
Example #24
0
    public List <Foe> readFoes(GameProgress.jankFile input)
    {
        // Determine number of unique foes
        string s = input.ReadLine();

        string[] split  = s.Split(' ');
        int      foeAmt = 0;

        int.TryParse(split[split.Length - 1], out foeAmt);

        // Read in each foe in the ecosystem
        Foe[] community = new Foe[foeAmt];
        for (int i = 0; i < foeAmt; i++)
        {
            input.ReadLine();
            input.ReadLine();
            string       foeName   = "";
            string       path      = "";
            int[]        stats     = new int[7];
            List <Skill> skillList = new List <Skill>();

            // Read in name
            s     = input.ReadLine();
            split = s.Split(' ');
            for (int j = 1; j < split.Length; j++)
            {
                foeName += split[j];
                if (j != split.Length - 1)
                {
                    foeName += " ";
                }
            }
            // Read in path
            path = input.ReadLine();
            // Read in stats
            s     = input.ReadLine();
            split = s.Split(' ');
            for (int j = 1; j < split.Length; j++)
            {
                int.TryParse(split[j], out stats[j - 1]);
            }
            // Open up the sprites in the path file
            Sprite[] source = Resources.LoadAll <Sprite>(@path);

            // Read in items
            int itemAmt;
            s     = input.ReadLine();
            split = s.Split(' ');
            int.TryParse(split[split.Length - 1], out itemAmt);
            Item[] drops    = new Item[itemAmt];
            int[]  dropRate = new int[itemAmt];

            for (int j = 0; j < itemAmt; j++)
            {
                int itemID, itemCount, itemOdds;
                s     = input.ReadLine();
                split = s.Split(' ');
                int.TryParse(split[0], out itemID);
                int.TryParse(split[1], out itemCount);
                int.TryParse(split[2], out itemOdds);

                Item theDrop = (Item)TitleManager.curFile.getItemList()[itemID];
                drops[j]    = theDrop.copy(itemCount);
                dropRate[j] = itemOdds;
            }

            // Read in skills
            int skillAmt;
            s     = input.ReadLine();
            split = s.Split(' ');
            int.TryParse(split[split.Length - 1], out skillAmt);

            int[]    skillOdds = new int[skillAmt];
            AItype[] ai        = new AItype[skillAmt];
            for (int j = 0; j < skillAmt; j++)
            {
                skillType       skill;
                string          atkName, des, skillSFX;
                element         atkEle;
                int             basePower, mpCost, range, effectChance;
                bool            isMagical, animLoop;
                float           start, end, fps;
                SpriteAnimation anim;

                battleType support    = battleType.NULL;
                status     statusMod  = status.NULL;
                int        scalar     = 0;
                stat       statBoost  = stat.NULL;
                bool       selfTarget = false;
                bool       targetAlly = false;

                s       = input.ReadLine();
                split   = s.Split('-');
                atkName = split[1];
                des     = input.ReadLine();

                // Read in odds then ai type
                s     = input.ReadLine();
                split = s.Split(' ');
                int.TryParse(split[split.Length - 1], out skillOdds[j]);
                s     = input.ReadLine();
                split = s.Split(' ');
                ai[j] = decideAI(split[split.Length - 1]);

                s     = input.ReadLine();
                split = s.Split(' ');
                if (split[split.Length - 1].CompareTo("Offensive") == 0)
                {
                    skill = skillType.OFFENSIVE;

                    // Attack element
                    s      = input.ReadLine();
                    split  = s.Split(' ');
                    atkEle = decideEle(split[split.Length - 1]);

                    // base power
                    s     = input.ReadLine();
                    split = s.Split(' ');
                    int.TryParse(split[split.Length - 1], out basePower);

                    // mp cost
                    s     = input.ReadLine();
                    split = s.Split(' ');
                    int.TryParse(split[split.Length - 1], out mpCost);

                    // is magical
                    s     = input.ReadLine();
                    split = s.Split(' ');
                    bool.TryParse(split[split.Length - 1], out isMagical);

                    // effect chance
                    s     = input.ReadLine();
                    split = s.Split(' ');
                    int.TryParse(split[split.Length - 1], out effectChance);
                    if (effectChance > 0)
                    {
                        /*
                         * implement me eventually
                         */
                    }

                    // range
                    s     = input.ReadLine();
                    split = s.Split(' ');
                    int.TryParse(split[split.Length - 1], out range);

                    // positions
                    s     = input.ReadLine();
                    split = s.Split(' ');
                    float.TryParse(split[split.Length - 1], out start);
                    s     = input.ReadLine();
                    split = s.Split(' ');
                    float.TryParse(split[split.Length - 1], out end);

                    // FPS
                    s     = input.ReadLine();
                    split = s.Split(' ');
                    float.TryParse(split[split.Length - 1], out fps);

                    // Sprite animation
                    int spriteAmt;
                    s     = input.ReadLine();
                    split = s.Split(' ');
                    if (split.Length > 2)
                    {
                        int.TryParse(split[split.Length - 2], out spriteAmt);
                        animLoop = true;
                    }
                    else
                    {
                        int.TryParse(split[split.Length - 1], out spriteAmt);
                        animLoop = false;
                    }
                    Sprite[] sprites = new Sprite[spriteAmt];
                    for (int k = 0; k < spriteAmt; k++)
                    {
                        s          = input.ReadLine();
                        sprites[k] = getSprite(source, s);
                    }
                    anim = new SpriteAnimation(sprites, new int[0], fps, animLoop);
                }
                else
                {
                    skill        = skillType.SUPPORT;
                    basePower    = 0;
                    effectChance = 0;
                    isMagical    = true;

                    // Attack element
                    s      = input.ReadLine();
                    split  = s.Split(' ');
                    atkEle = decideEle(split[split.Length - 1]);

                    // mp cost
                    s     = input.ReadLine();
                    split = s.Split(' ');
                    int.TryParse(split[split.Length - 1], out mpCost);

                    // range
                    s     = input.ReadLine();
                    split = s.Split(' ');
                    int.TryParse(split[split.Length - 1], out range);

                    // positions
                    s     = input.ReadLine();
                    split = s.Split(' ');
                    float.TryParse(split[split.Length - 1], out start);
                    s     = input.ReadLine();
                    split = s.Split(' ');
                    float.TryParse(split[split.Length - 1], out end);

                    // status variables
                    s         = input.ReadLine();
                    split     = s.Split(' ');
                    support   = decideSupport(split[split.Length - 1]);
                    s         = input.ReadLine();
                    split     = s.Split(' ');
                    statusMod = decideStatus(split[split.Length - 1]);
                    s         = input.ReadLine();
                    split     = s.Split(' ');
                    statBoost = decideStat(split[split.Length - 1]);
                    s         = input.ReadLine();
                    split     = s.Split(' ');
                    int.TryParse(split[split.Length - 1], out scalar);
                    s     = input.ReadLine();
                    split = s.Split(' ');
                    bool.TryParse(split[split.Length - 1], out selfTarget);
                    s     = input.ReadLine();
                    split = s.Split(' ');
                    bool.TryParse(split[split.Length - 1], out targetAlly);

                    // FPS
                    s     = input.ReadLine();
                    split = s.Split(' ');
                    float.TryParse(split[split.Length - 1], out fps);

                    // Sprite animation
                    int spriteAmt;
                    s     = input.ReadLine();
                    split = s.Split(' ');
                    if (split.Length > 2)
                    {
                        int.TryParse(split[split.Length - 2], out spriteAmt);
                        animLoop = true;
                    }
                    else
                    {
                        int.TryParse(split[split.Length - 1], out spriteAmt);
                        animLoop = false;
                    }
                    Sprite[] sprites = new Sprite[spriteAmt];
                    for (int k = 0; k < spriteAmt; k++)
                    {
                        s          = input.ReadLine();
                        sprites[k] = getSprite(source, s);
                    }
                    anim = new SpriteAnimation(sprites, new int[0], fps, animLoop);
                }
                // Get SFX path
                input.ReadLine();
                skillSFX = input.ReadLine();

                Skill move = new Skill(skill, atkName, des, atkEle, mpCost, range, start, end, anim, skillSFX);
                move.setAttack(basePower, isMagical, effectChance);
                if (skill == skillType.SUPPORT)
                {
                    move.setSupport(support, statusMod, statBoost, scalar, selfTarget, targetAlly);
                }
                skillList.Add(move);
            }
            // Hitboxes
            int hitboxAmt;
            s     = input.ReadLine();
            split = s.Split(' ');
            int.TryParse(split[split.Length - 1], out hitboxAmt);
            HitBox[] boxes = new HitBox[hitboxAmt];
            for (int j = 0; j < hitboxAmt; j++)
            {
                s     = input.ReadLine();
                split = s.Split(' ');
                float x, y, xs, ys;
                float.TryParse(split[0], out x);
                float.TryParse(split[1], out y);
                float.TryParse(split[2], out xs);
                float.TryParse(split[3], out ys);

                boxes[j] = new HitBox((x / 2) + xs, (y / 2) + ys, (-x / 2) + xs, (-y / 2) + ys);
            }
            // Gravity
            float gravity;
            s     = input.ReadLine();
            split = s.Split(' ');
            float.TryParse(split[split.Length - 1], out gravity);

            // Read in standard animations
            input.ReadLine();
            input.ReadLine();
            string facePath = input.ReadLine();
            Sprite face     = getSprite(Resources.LoadAll <Sprite>(@facePath), input.ReadLine());
            List <SpriteAnimation> anims = new List <SpriteAnimation>();
            for (int j = 0; j < 5; j++)
            {
                input.ReadLine();
                // FPS
                float fps;
                s     = input.ReadLine();
                split = s.Split(' ');
                float.TryParse(split[split.Length - 1], out fps);

                // Sprite animation
                int spriteAmt;
                s     = input.ReadLine();
                split = s.Split(' ');
                int.TryParse(split[split.Length - 1], out spriteAmt);

                Sprite[] sprites = new Sprite[spriteAmt];
                for (int k = 0; k < spriteAmt; k++)
                {
                    s          = input.ReadLine();
                    sprites[k] = getSprite(source, s);
                }
                SpriteAnimation anim = new SpriteAnimation(sprites, new int[0], fps, true);
                anims.Add(anim);
            }

            Foe inhabitant = new Foe(foeName, stats, skillList, skillOdds, ai, drops, dropRate, boxes, gravity);
            inhabitant.setAnimations(face, anims[0], anims[1], anims[2], anims[3], anims[4]);
            community[i] = inhabitant;
        }

        // Create an empty foe set so you don't have to use NULL
        int[] nothing = { 0, 0, 0, 0, 0, 0, 0 };
        Foe   empty   = new Foe("", nothing, new List <Skill>(), new int[0], new AItype[0], new Item[0], new int[0], new HitBox[0], 0);

        // Read in sets of enemies
        input.ReadLine();
        int setAmt;

        s     = input.ReadLine();
        split = s.Split(' ');
        int.TryParse(split[split.Length - 1], out setAmt);
        List <Foe> foeList = new List <Foe>();

        for (int j = 0; j < 1; j++)
        {
            input.ReadLine();
            // Read in rate
            s = input.ReadLine();
            // Read in foes
            int foeCount;
            s     = input.ReadLine();
            split = s.Split(' ');
            int.TryParse(split[split.Length - 1], out foeCount);
            for (int k = 0; k < 5; k++)
            {
                if (k < foeCount)
                {
                    int foeNum;
                    s = input.ReadLine();
                    int.TryParse(s, out foeNum);
                    foeList.Add(community[foeNum]);
                }
                else
                {
                    foeList.Add(empty);
                }
            }
        }
        return(foeList);
    }
 /// <summary>
 /// Drops a Foe face from HUD.
 /// </summary>
 /// <param name="foe">Target Foe resource to remove.</param>
 public void DropFace(Foe foe)
 {
     faces.Remove(CreateFaceDetails(foe));
     RefreshFaces();
 }
 /// <summary>
 /// Adds a Foe face to HUD.
 /// Foe faces should always be humanoid as there are no portraits for monstrous enemies.
 /// Always creates a Breton face for now.
 /// </summary>
 /// <param name="foe">Target Foe resource to add.</param>
 public void AddFace(Foe foe)
 {
     faces.Add(CreateFaceDetails(foe));
     RefreshFaces();
 }
 /// <summary>
 /// Drops a Foe face from HUD.
 /// </summary>
 /// <param name="foe">Target Foe resource to remove.</param>
 public void DropFace(Foe foe)
 {
     faces.RemoveAll(face => face.questUID == foe.ParentQuest.UID && foe.Symbol.Equals(face.targetFoe));
     RefreshFaces();
 }
Example #28
0
        private void Battle()
        {
            if (_currentNpc is IBattle)
            {
                IBattle battleNpc          = _currentNpc as IBattle;
                int     playerHitPoints    = 0;
                int     battleNpcHitPoints = 0;
                string  battleInformation  = "";
                if (battleNpc is Foe)
                {
                    Foe battlingNpc = _currentNpc as Foe;
                    if (_player.CurrentWeapon != null)
                    {
                        playerHitPoints     = CalculatePlayerHitPoints();
                        battlingNpc.Health -= playerHitPoints;
                        battleInformation   = $"you are using {_player.CurrentWeapon.Name} as your weapon." + Environment.NewLine;
                    }
                    else
                    {
                        playerHitPoints   = 2;
                        battleInformation = "It appears you are entering into battle without a weapon." + Environment.NewLine;
                    }



                    if (battleNpc.CurrentWeapon != null)
                    {
                        battleNpcHitPoints = CalculateNpcHitPoints(battleNpc);
                        _player.Health    -= battleNpcHitPoints;
                    }
                    else
                    {
                        battleInformation = $"It appears you are entering into battle with {_currentNpc.Name} who has no weapon." + Environment.NewLine;
                    }


                    battleInformation +=
                        $"Player: {_player.BattleMode}     Hit Points: {playerHitPoints}" + Environment.NewLine +
                        $"Payer Health: {_player.Health}" + Environment.NewLine +
                        $"NPC: {battleNpc.BattleMode}     Hit Points: {battleNpcHitPoints}" + Environment.NewLine +
                        $"Foe Health: {battlingNpc.Health}";



                    if (battlingNpc.Health <= 0)
                    {
                        {
                            battleInformation += $"\n\nYou have destroyed {_currentNpc.Name}.";

                            if (_currentNpc is Foe)
                            {
                                if (battlingNpc.Loot != null)
                                {
                                    _player.Inventory.Add(battlingNpc.Loot);
                                }
                            }
                            _currentLocation.Npcs.Remove(_currentNpc);
                        }
                        if (battlingNpc.Id == 5004)
                        {
                            OnPlayerWin();
                        }
                    }
                }
                if (_player.Health <= 0)
                {
                    battleInformation += $"\n\nYou have been killed by {_currentNpc.Name}.";
                    _player.Lives--;

                    _player.Health = 100;
                }

                CurrentLocationInformation = battleInformation;
                if (_player.Lives <= 0)
                {
                    OnPlayerDies("You have died. Game Over");
                }
            }
            else
            {
                CurrentLocationInformation = "Don't hit your Friends! \n{-10 XP}";
                _player.ExpierencePoints  -= 10;
            }
        }
Example #29
0
 public FoeWalk(Foe Parent, float Speed, bool fpe)
 {
     parent            = Parent;
     speed             = Speed;
     flipAtPlatformEnd = fpe;
 }
Example #30
0
        public static void combat_turn(ref Hero player, ref Foe enemy)
        {
            int CombatP, CombatF;

            CombatP = 0;
            CombatF = 0;

            int ProtectP, ProtectF;

            ProtectP = 0;
            ProtectF = 0;

            Sphere off_sphere;
            Sphere def_sphere;

            switch (player.Plan)
            {
            case Action.Idle:
                CombatP  = player.rollLuck();
                ProtectP = player.rollLuck() + player.Armor.Defensive_Bonus();
                break;

            case Action.Attack:
                CombatP = player.rollLuck() + player.rollCombat() + player.Weapon.Combat_Modifier(enemy.Alignment);
                if (player.Weapon.Enchanted)
                {
                    CombatP += player.Weapon.Enchanted_Modifier(enemy.Alignment);
                }
                ProtectP = player.rollLuck() + player.Armor.Defensive_Bonus();
                break;

            case Action.Defend:
                CombatP    = player.Weapon.Combat_Modifier(enemy.Alignment);
                ProtectP   = player.rollProtection() + player.Armor.Defensive_Bonus();
                off_sphere = enemy.Weapon.Elemental | enemy.Weapon.Enchantment | enemy.Pact;
                def_sphere = player.Alignment | player.Gift | player.Pact | player.Armor.Resistance;
                if ((off_sphere & def_sphere) > 0)
                {
                    ProtectP += player.rollProtection() + player.Armor.Defensive_Bonus();
                }

                break;

            case Action.Magic:
                player.Channel();
                if (player.Magic_Force > player.Magic_Control)
                {
                    CombatP  = (player.Magic_Force * ActionHandler.sphere_comparison(player.Gift, enemy.Alignment)) / 4;
                    ProtectP = player.rollLuck() + player.Armor.Defensive_Bonus();
                    player.receiveHarm(player.Magic_Force - player.Magic_Control);
                }
                else
                {
                    CombatP  = (player.Magic_Force * ActionHandler.sphere_comparison(player.Gift, enemy.Alignment)) / 4;
                    ProtectP = player.Magic_Control + player.rollLuck() + player.Armor.Defensive_Bonus();
                    bool casting = true;
                    while (casting)
                    {
                        int magicka = DiceRoller.spell_selection(player.Spellbook.Count);
                        switch (player.Spellbook[magicka].spell)
                        {
                        case Spell.Magic_Aura:
                            CombatP  += player.rollLuck();
                            ProtectP += player.rollLuck();
                            break;

                        case Spell.Magic_Beam:
                            CombatP += ((player.Magic_Force + player.rollSpirit()) * ActionHandler.sphere_comparison(player.Spellbook[magicka].sphere, enemy.Alignment)) / 4;
                            break;

                        case Spell.Magic_Blast:
                            CombatP += (player.Magic_Force * ActionHandler.sphere_comparison(player.Spellbook[magicka].sphere, enemy.Alignment)) / 4;
                            break;

                        case Spell.Magic_Bolt:
                            CombatP += (player.rollSpirit() * ActionHandler.sphere_comparison(player.Spellbook[magicka].sphere, enemy.Alignment)) / 4;
                            break;

                        case Spell.Magic_Courage:
                            player.moraleRally();
                            break;

                        case Spell.Magic_Fear:
                            enemy.moraleBreak();
                            break;

                        case Spell.Magic_Haste:
                            player.Reaction++;
                            break;

                        case Spell.Magic_Restoration:
                            player.beHealed(player.Magic_Force);
                            break;

                        case Spell.Magic_Shield:
                            ProtectP += (player.Magic_Control);
                            break;

                        case Spell.Pact_Annihilate:
                            CombatP += (((player.Magic_Control) * ActionHandler.sphere_comparison(player.Spellbook[magicka].sphere, enemy.Gift)) / 4);
                            break;

                        case Spell.Pact_Armor:
                            ProtectP += player.rollSpirit() + player.rollProtection();
                            player.Armor.Resistance = player.Armor.Resistance | player.Spellbook[magicka].sphere;
                            break;

                        case Spell.Pact_Drain:
                            CombatP += ((player.Magic_Force + player.rollSpirit()) * ActionHandler.sphere_comparison(player.Spellbook[magicka].sphere, enemy.Alignment)) / 4;
                            player.beHealed(CombatP);
                            break;

                        case Spell.Pact_Reprisal:
                            CombatP += ProtectP;
                            ProtectP = CombatP;
                            break;

                        case Spell.Pact_Shift:
                            if (player.Weapon.Enchanted == true)
                            {
                                player.Weapon.Enchantment = player.Pact;
                            }
                            player.Armor.Resistance = player.Armor.Resistance | player.Pact;
                            break;

                        case Spell.Pact_Spellstrike:
                            CombatP += (((player.rollCombat() + player.Weapon.Combat_Modifier(enemy.Alignment)) * ActionHandler.sphere_comparison(player.Spellbook[magicka].sphere, enemy.Alignment)) / 4);
                            if (player.Weapon.Enchanted)
                            {
                                CombatP += player.Weapon.Enchanted_Modifier(enemy.Alignment);
                            }
                            break;

                        case Spell.Pact_Weapon:
                            player.Weapon.Enchanted   = true;
                            player.Weapon.Enchantment = player.Spellbook[magicka].sphere;
                            break;
                        }
                        player.Magic_Force   = (player.Magic_Force / 2) + player.rollSpirit();
                        player.Magic_Control = (player.Magic_Control / 2) + player.rollSpirit();
                        if ((player.Magic_Force < player.Magic_Control) || (player.Magic_Force < 0) || (player.Magic_Control < 0))
                        {
                            casting = false;
                        }
                    }
                }
                off_sphere = player.Gift | player.Pact;
                def_sphere = enemy.Alignment | enemy.Gift | enemy.Pact | enemy.Armor.Resistance;
                if ((off_sphere & def_sphere) > 0)
                {
                    CombatP -= (enemy.rollProtection() + enemy.Armor.Defensive_Bonus());
                }
                break;

            case Action.Potion:
                if (player.Bottle.Doses > 0)
                {
                    player.Bottle.Doses--;
                    player.beHealed(player.Bottle.effect());
                    player.resolve -= player.amPoisoned;
                    if (player.Bottle.bonus() > 0)
                    {
                        player.reFocus(player.Bottle.bonus());
                        player.resolve -= player.amTired;
                    }
                }
                break;
            }

            switch (enemy.Plan)
            {
            case Action.Idle:
                CombatF  = enemy.rollLuck();
                ProtectF = enemy.rollLuck() + enemy.Armor.Defensive_Bonus();
                break;

            case Action.Attack:
                CombatF = enemy.rollLuck() + enemy.rollCombat() + enemy.Weapon.Combat_Modifier(player.Alignment);
                if (enemy.Weapon.Enchanted)
                {
                    CombatF += enemy.Weapon.Enchanted_Modifier(player.Alignment);
                }
                ProtectF = enemy.rollLuck() + enemy.Armor.Defensive_Bonus();
                break;

            case Action.Defend:
                CombatF    = enemy.Weapon.Combat_Modifier(player.Alignment);
                ProtectF   = enemy.rollProtection() + enemy.Armor.Defensive_Bonus();
                off_sphere = player.Weapon.Elemental | player.Weapon.Enchantment | player.Pact;
                def_sphere = enemy.Alignment | enemy.Gift | enemy.Pact | enemy.Armor.Resistance;
                if ((off_sphere & def_sphere) > 0)
                {
                    ProtectF += enemy.rollProtection() + enemy.Armor.Defensive_Bonus();
                }

                break;

            case Action.Magic:
                enemy.Channel();
                if (enemy.Magic_Force > enemy.Magic_Control)
                {
                    CombatF  = (enemy.Magic_Force * ActionHandler.sphere_comparison(enemy.Gift, player.Alignment)) / 4;
                    ProtectF = enemy.rollLuck() + enemy.Armor.Defensive_Bonus();
                    enemy.receiveHarm(enemy.Magic_Force - enemy.Magic_Control);
                }
                else
                {
                    CombatF  = (enemy.Magic_Force * ActionHandler.sphere_comparison(enemy.Gift, player.Alignment)) / 4;
                    ProtectF = enemy.Magic_Control + enemy.rollLuck() + enemy.Armor.Defensive_Bonus();
                    bool casting = true;
                    while (casting)
                    {
                        int magicka = DiceRoller.spell_selection(enemy.Spellbook.Count);
                        switch (enemy.Spellbook[magicka].spell)
                        {
                        case Spell.Magic_Aura:
                            CombatF  += enemy.rollLuck();
                            ProtectF += enemy.rollLuck();
                            break;

                        case Spell.Magic_Beam:
                            CombatF += ((enemy.Magic_Force + enemy.rollSpirit()) * ActionHandler.sphere_comparison(enemy.Spellbook[magicka].sphere, player.Alignment)) / 4;
                            break;

                        case Spell.Magic_Blast:
                            CombatF += (enemy.Magic_Force * ActionHandler.sphere_comparison(enemy.Spellbook[magicka].sphere, player.Alignment)) / 4;
                            break;

                        case Spell.Magic_Bolt:
                            CombatF += (enemy.rollSpirit() * ActionHandler.sphere_comparison(enemy.Spellbook[magicka].sphere, player.Alignment)) / 4;
                            break;

                        case Spell.Magic_Courage:
                            enemy.moraleRally();
                            break;

                        case Spell.Magic_Fear:
                            player.moraleBreak();
                            break;

                        case Spell.Magic_Haste:
                            enemy.Reaction++;
                            break;

                        case Spell.Magic_Restoration:
                            enemy.beHealed(enemy.Magic_Force);
                            break;

                        case Spell.Magic_Shield:
                            ProtectF += (enemy.Magic_Control);
                            break;

                        case Spell.Pact_Annihilate:
                            CombatF += (((enemy.Magic_Control) * ActionHandler.sphere_comparison(enemy.Spellbook[magicka].sphere, player.Gift)) / 4);
                            break;

                        case Spell.Pact_Armor:
                            ProtectF += enemy.rollSpirit() + enemy.rollProtection();
                            enemy.Armor.Resistance = enemy.Armor.Resistance | enemy.Spellbook[magicka].sphere;
                            break;

                        case Spell.Pact_Drain:
                            CombatF += ((enemy.Magic_Force + enemy.rollSpirit()) * ActionHandler.sphere_comparison(enemy.Spellbook[magicka].sphere, player.Alignment)) / 4;
                            enemy.beHealed(CombatF);
                            break;

                        case Spell.Pact_Reprisal:
                            CombatF += ProtectF;
                            ProtectF = CombatF;
                            break;

                        case Spell.Pact_Shift:
                            if (enemy.Weapon.Enchanted == true)
                            {
                                enemy.Weapon.Enchantment = enemy.Pact;
                            }
                            enemy.Armor.Resistance = enemy.Armor.Resistance | enemy.Pact;
                            break;

                        case Spell.Pact_Spellstrike:
                            CombatF += (((enemy.rollCombat() + enemy.Weapon.Combat_Modifier(player.Alignment)) * ActionHandler.sphere_comparison(enemy.Spellbook[magicka].sphere, player.Alignment)) / 4);
                            if (enemy.Weapon.Enchanted)
                            {
                                CombatF += enemy.Weapon.Enchanted_Modifier(player.Alignment);
                            }
                            break;

                        case Spell.Pact_Weapon:
                            enemy.Weapon.Enchanted   = true;
                            enemy.Weapon.Enchantment = enemy.Spellbook[magicka].sphere;
                            break;
                        }
                        enemy.Magic_Force   = (enemy.Magic_Force / 2) + enemy.rollSpirit();
                        enemy.Magic_Control = (enemy.Magic_Control / 2) + enemy.rollSpirit();
                        if ((enemy.Magic_Force < enemy.Magic_Control) || (enemy.Magic_Force < 0) || (enemy.Magic_Control < 0))
                        {
                            casting = false;
                        }
                    }
                }
                off_sphere = enemy.Gift | enemy.Pact;
                def_sphere = player.Alignment | player.Gift | player.Pact | player.Armor.Resistance;
                if ((off_sphere & def_sphere) > 0)
                {
                    CombatF -= (player.rollProtection() + player.Armor.Defensive_Bonus());
                }
                break;

            case Action.Potion:
                if (enemy.Bottle.Doses > 0)
                {
                    enemy.Bottle.Doses--;
                    enemy.beHealed(enemy.Bottle.effect());
                    enemy.resolve -= enemy.amPoisoned;
                    if (enemy.Bottle.bonus() > 0)
                    {
                        enemy.reFocus(enemy.Bottle.bonus());
                        enemy.resolve -= enemy.amTired;
                    }
                }
                break;
            }

            if (player.Reaction > enemy.Reaction)
            {
                if (CombatP > ProtectF)
                {
                    if (ProtectP > CombatF)
                    { //fast total success: player
                        enemy.receiveHarm(CombatP);
                    }
                    else
                    { //fast minor success: player
                        enemy.receiveHarm(CombatP - ProtectF);
                    }
                }
                if (CombatF > ProtectP)
                {
                    if (ProtectF > CombatP)
                    { //slow total success: foe
                        player.receiveHarm(CombatF);
                    }
                    else
                    { //slow minor success: foe
                        player.receiveHarm(CombatF - ProtectP);
                    }
                }
            }
            else
            {
                if (CombatF > ProtectP)
                {
                    if (ProtectF > CombatP)
                    { //fast total success: foe
                        player.receiveHarm(CombatF);
                    }
                    else
                    { //fast minor success: foe
                        player.receiveHarm(CombatF - ProtectP);
                    }
                }
                if (CombatP > ProtectF)
                {
                    if (ProtectP > CombatF)
                    { //slow total success: player
                        enemy.receiveHarm(CombatP);
                    }
                    else
                    { //slow minor success: player
                        enemy.receiveHarm(CombatP - ProtectF);
                    }
                }
            }
        }