Наследование: MonoBehaviour
Пример #1
0
 static void Main()
 {
     Teacher Eng = new Teacher("박미영", 35, "영어");
     Thief KangDo = new Thief("야월담", 25, 3);
     Eng.Teach();
     KangDo.Steal();
 }
Пример #2
0
        /*
         * Create Player Class
         */
        public Player CreatePlayer()
        {
            Console.WriteLine("Select Class: (1) Warrior. (2) Mage. (3) Theif.");
            string choice = Console.ReadLine();

            if (choice == "1")
            {
                Warrior player = new Warrior();
                return(player);
            }
            else if (choice == "2")
            {
                Mage player = new Mage();
                return(player);
            }
            else if (choice == "3")
            {
                Thief player = new Thief();
                return(player);
            }
            else
            {
                return(null);
            }
        }
Пример #3
0
        private void initBehaviourModel(string prof)
        {
            switch (prof)
            {
            case "craftsman":
                Behaviour = new Craftsman(this, ProfLevels[prof]);
                break;

            case "farmer":
                Behaviour = new Farmer(this, ProfLevels[prof]);
                break;

            case "guardian":
                Behaviour = new Guardian(this, ProfLevels[prof]);
                break;

            case "thief":
                Behaviour = new Thief(this, ProfLevels[prof]);
                break;

            case "trader":
                Behaviour = new Trader(this, ProfLevels[prof]);
                break;

            default: throw new Exception("Wrong proffession");
            }

            Log.Add("citizens:Human " + Name + " behaviour: " + prof);
        }
Пример #4
0
        public void TestSetThievesAbilities_WhereCharacterIsSecondLevel()
        {
            Dictionary <Dungeons_and_Dragons.Attribute, int> dict = new Dictionary <Dungeons_and_Dragons.Attribute, int>();

            dict.Add(Dungeons_and_Dragons.Attribute.Strength, 12);
            dict.Add(Dungeons_and_Dragons.Attribute.Dexterity, 14);
            dict.Add(Dungeons_and_Dragons.Attribute.Intelligence, 6);
            dict.Add(Dungeons_and_Dragons.Attribute.Wisdom, 17);
            dict.Add(Dungeons_and_Dragons.Attribute.Constitution, 8);
            dict.Add(Dungeons_and_Dragons.Attribute.Charisma, 14);
            int   xp    = 1200;
            int   hp    = 3;
            Thief thief = new Thief("MarkyMark", Race.Elf, dict, hp, xp);

            Assert.AreEqual(20, thief.thievingAbilities[ThiefAbilities.PickLock],
                            "TEST1: The value returned for PickLock was not as expected");
            Assert.AreEqual(15, thief.thievingAbilities[ThiefAbilities.FindRemoveTraps],
                            "TEST2: The value returned for Find/Remove traps was not as expected");
            Assert.AreEqual(25, thief.thievingAbilities[ThiefAbilities.PickPocket],
                            "TEST3: The value returned for pick pocket was not as expected");
            Assert.AreEqual(25, thief.thievingAbilities[ThiefAbilities.MoveSilently],
                            "TEST4: The value returned for move silently was not as expected");
            Assert.AreEqual(88, thief.thievingAbilities[ThiefAbilities.ClimbSheerSurfaces],
                            "TEST5: The value returned for climb sheer surfaces was not as expected");
            Assert.AreEqual(15, thief.thievingAbilities[ThiefAbilities.HideInShadows],
                            "TEST6: The value returned for hide in shadows was not as expected");
            Assert.AreEqual(33, thief.thievingAbilities[ThiefAbilities.HearNoise],
                            "TEST7: The value returned for hear noise was not as expected");
        }
Пример #5
0
    // Update is called once per frame
    void Update()
    {
        hit = Physics2D.OverlapBoxAll((Vector2)transform.position + checkOffset, checkSize, 0, playerMask);
        if (hit.Length > 0)
        {
            Thief thief = null;
            foreach (Collider2D col in hit)
            {
                col.TryGetComponent(out thief);
                if (thief == null)
                {
                    break;
                }
            }

            if (!trapActive && (thief == null || !thief.usingInvisibility))
            {
                StartCoroutine(ShootArrow());
                trapActive = true;
            }
            else if (trapActive && thief != null && thief.usingInvisibility)
            {
                trapActive = false;
                StopAllCoroutines();
            }
        }
        else
        {
            if (trapActive)
            {
                StopAllCoroutines();
                trapActive = false;
            }
        }
    }
Пример #6
0
    public void StartGame()
    {
        turnCount            = maxTurn;
        csTeamNameText.text  = csTeamName;
        scsTeamNameText.text = scsTeamName;

        isCSPolice = round % 2 == 0;

        string policeName = (isCSPolice ? csTeamName : scsTeamName) + ".PoliceAI";
        string thiefName  = (isCSPolice ? scsTeamName : csTeamName) + ".ThiefAI";

        Debug.Log(policeName);
        Debug.Log(thiefName);

        policeAI = Activator.CreateInstance(Type.GetType(policeName)) as Police;
        thiefAI  = Activator.CreateInstance(Type.GetType(thiefName)) as Thief;

        thiefCatchAlert.rectTransform.localPosition      = new Vector3(245 * (isCSPolice ? -1 : 1), 0);
        treasureCaptureAlert.rectTransform.localPosition = new Vector3(245 * (isCSPolice ? 1 : -1), 0);

        policeErrorAlert.rectTransform.localPosition = new Vector3(245 * (isCSPolice ? -1 : 1), 0);
        thiefErrorAlert.rectTransform.localPosition  = new Vector3(245 * (isCSPolice ? 1 : -1), 0);

        policeIcon.rectTransform.localPosition = new Vector3(780 * (isCSPolice ? -1 : 1), policeIcon.rectTransform.localPosition.y);
        thiefIcon.rectTransform.localPosition  = new Vector3(780 * (isCSPolice ? 1 : -1), thiefIcon.rectTransform.localPosition.y);

        mapManager.InitiateMap();
        StartCoroutine(InitiateAgents());
    }
Пример #7
0
    private void LateUpdate()
    {
        if (ariaHit.Find)
        {
            if (!one)
            {
                thiefManager = ariaHit.TargetObj.GetComponent <Thief>();
                one          = true;
            }
            timer += Time.deltaTime;
            if (timer >= AS)
            {
                thiefManager.HP -= STR;
                timer            = 0;
            }
            if (thiefManager.HP <= 0)
            {//敵をたおしたら探索をやめる
                one          = false;
                ariaHit.Find = false;
            }
        }
        else if (!ariaHit.Find)
        {
            one          = false;
            thiefManager = null; //敵を見失ったときリセットする
        }
        if (slider.value <= 0)   //0になると自身が消滅
        {
            Destroy(gameObject);
        }

        slider.value = HP;//常にUIへ更新
    }
Пример #8
0
        void GetCustomers(Random random, int count)
        {
            Customer customer = new Customer(random);
            int      customergen;

            for (int i = 0; i <= count; i++)
            {
                customergen = random.Next(0, 100);
                if (customergen > 0 && customergen < 6)
                {
                    customer = new Thief(random);
                }
                else if (customergen > 6 && customergen < 12)
                {
                    customer = new Cop(random);
                }
                else if (customergen == 0)
                {
                    customer = new Duck(random);
                }
                else
                {
                    customer = new Customer(random);
                }
                customers.Add(customer);
            }
        }
Пример #9
0
    public Hero CreateThief()
    {
        Hero thief = new Thief(100.0f, 5, 5, 10, "Thief", 1);

        //thief.ClassText = "Thief";
        return(thief);
    }
Пример #10
0
 public void atemptArrest(Thief t)
 {
     if (t.isCriminal())
     {
         announcements[anounC] = "Stop right there criminal scum! Nobody breaks the law on my watch! ";
         anounC++;
         announcements[anounC] = "I'm confiscating your stolen goods. And then it is off to jail!";
         anounC++;
         string s = "";
         while (t.hasStuff())
         {
             Sak stolenGoods = t.loose1Item();
             int confCounter = 0;
             while (inventory[confCounter] != Sak.Inget)
             {
                 confCounter++;
             }
             s = s + (" " + stolenGoods);
             inventory[confCounter] = stolenGoods;
             if (s.Length > 100)
             {
                 announcements[anounC] = s;
                 anounC++;
                 s = "";
             }
         }//end while loop for the whole list of stolen property!
         announcements[anounC] = s + "<things confiscated>";
         anounC++;
         t.youDoneGoofed();
         announcements[anounC] = (t.getName() + " was sent to jail ");
         anounC++;
         thiefCaught = true;
     } // end BECAUSE IM A CRIMINAL!
 }
Пример #11
0
        public static void startRPG()
        {
            Hero  h1 = new Hero();
            Thief t1 = new Thief();

            t1.name = "Biggs";
            Thief t2 = new Thief();

            t2.name    = "Wedge";
            t2.attack += 4;
            t2.health += 30;
            Boss b1     = new Boss();
            int  health = 0;
            int  attack = 0;
            int  level  = 0;

            health = h1.health;
            attack = h1.attack;
            level  = h1.level;

            intro(h1);
            fightThief(h1, t1);
            levelUpOne(h1, health, attack, level);
            health = h1.health;
            attack = h1.attack;
            level  = h1.level;
            fightThief(h1, t2);
            levelUpTwo(h1, health, attack, level);
            bossBattle(h1, b1);
        }
Пример #12
0
        public static void enemyBattlePhase(Hero h1, Thief t1)
        {
            int criticalHit = 0;
            int damage      = 0;

            criticalHit = r1.Next(1, 100);

            if (criticalHit < 21)
            {
                h1.health -= t1.attack + 5;
                damage     = t1.attack + 5;
                Console.WriteLine("The enemy landed a critical hit!");
                Console.WriteLine("You've taken " + damage + " damage!");
                Console.WriteLine("You now have " + h1.health + " health left!");
            }
            else
            {
                h1.health -= t1.attack;
                damage     = t1.attack;
                Console.WriteLine("The enemy landed a normal hit!");
                Console.WriteLine("You've taken " + damage + " damage!");
                Console.WriteLine("You now have " + h1.health + " health left!");
            }
            Console.WriteLine("Enter any key to continue.");
            Console.ReadKey();
            Console.Clear();
        }
Пример #13
0
        public void SetThiefLevelTest()
        {
            Dictionary <Dungeons_and_Dragons.Attribute, int> dict = new Dictionary <Dungeons_and_Dragons.Attribute, int>();

            dict.Add(Dungeons_and_Dragons.Attribute.Strength, 15);
            dict.Add(Dungeons_and_Dragons.Attribute.Dexterity, 10);
            dict.Add(Dungeons_and_Dragons.Attribute.Intelligence, 3);
            dict.Add(Dungeons_and_Dragons.Attribute.Wisdom, 8);
            dict.Add(Dungeons_and_Dragons.Attribute.Constitution, 17);
            dict.Add(Dungeons_and_Dragons.Attribute.Charisma, 9);
            int   xp    = 0;
            int   hp    = 3;
            Thief thief = new Thief("Stickie", Race.Elf, dict, hp, xp);

            thief.IncreaseExperiencePoints(0);

            Assert.AreEqual(1, thief.currentLevel, "TEST1: The level is not as expected");

            thief.IncreaseExperiencePoints(1199);

            Assert.AreEqual(1, thief.currentLevel, "TEST2: The level is not as expected");

            thief.IncreaseExperiencePoints(1);

            Assert.AreEqual(2, thief.currentLevel, "TEST3: The level is not as expected");

            thief.IncreaseExperiencePoints(1199);

            Assert.AreEqual(2, thief.currentLevel, "TEST4: The level is not as expected");

            thief.IncreaseExperiencePoints(1);

            Assert.AreEqual(3, thief.currentLevel, "TEST5: The level is not as expected");
        }
Пример #14
0
        public void ThiefEncounterNegativeCaseIfItems0()
        {
            //arrange
            Dictionary <Item, int> inv = new Dictionary <Item, int>();

            Cart cart = new Cart
            {
                Gold          = 100,
                ProtectionLvl = 0,
                Inventory     = inv
            };
            Thief theif = new Thief();

            theif.RobAmount = 100;
            Shopkeeper shopkeeper = new Shopkeeper("", cart);
            GameEngine gameEngine = new GameEngine(shopkeeper, theif);

            //act
            Result result = gameEngine.RunEncounter();

            //assert
            Assert.IsFalse(result.IsSuccess);
            Assert.AreEqual($"Rats! You encounter bandits, and they steal 100 gold. Fortunately? you" +
                            $" didn't have any items to steal.", result.Message);
        }
Пример #15
0
        public static void playerBattlePhase(Hero h1, Thief t1)
        {
            Console.WriteLine("-----------------------------------------------------------------------------------------------------------------------");
            Console.WriteLine("You have three actions you can choose from.");
            Console.WriteLine("The fist option attack will deal the same amount of damage as your attack stat.");
            Console.WriteLine("The second option Roulette Attack is a risk vs. reward attack.");
            Console.WriteLine("You will have 3 chances to guess a number between 1 and 5. If you guess correctly you will do double damage.");
            Console.WriteLine("However if you guess wrong all three times you will only do 1 damage!");
            Console.WriteLine("The last option is to use a potion to heal yourself for 10 health but be careful! You only get 3 for the whole game!");
            Console.WriteLine("-----------------------------------------------------------------------------------------------------------------------");
            Console.WriteLine();
            Console.WriteLine();
            int action = 0;

            Console.WriteLine("Select your action!");
            Console.WriteLine("1: Attack");
            Console.WriteLine("2: Roulette Attack");
            Console.WriteLine("3: Use Potion");
            action = getInt();
            while ((action < 1) || (action > 3))
            {
                Console.WriteLine("You've entered an invalid choice. Please enter 1, 2, or 3.");
                action = getInt();
            }
            while (action == 3 && h1.potions == 0)
            {
                Console.WriteLine("Sorry! You are out of potions! Please choose a different action.");
                action = getInt();
            }
            switch (action)
            {
            case 1:
                t1.attacked(h1);
                Console.WriteLine("You attacked for " + h1.attack + " damage!");
                Console.WriteLine("The enemy has " + t1.health + " left!");
                Console.WriteLine("Enter any key to continue.");
                Console.ReadKey();
                Console.Clear();
                break;

            case 2:
                rouletteAttack(h1, t1);
                Console.WriteLine("Enter any key to continue.");
                Console.ReadKey();
                Console.Clear();
                break;

            case 3:
                usePotion(h1);
                Console.WriteLine("Enter any key to continue.");
                Console.ReadKey();
                Console.Clear();
                break;

            default:
                Console.WriteLine("Error in battle phase.");
                break;
            }
        }
Пример #16
0
 void Bystander_OnThiefSpotted(Bystander bystander, Thief thief)
 {
     if (CurrentTarget == bystander)
     {
         CurrentTarget = null;
         ChooseTarget();
     }
 }
Пример #17
0
    /// <summary>
    /// Método SpawnVillagers, que instancia al ladrón y a los aldeanos en la partida
    /// </summary>
    public void SpawnVillagers()
    {
        List <Transform> updatedVillagerPoints = new List <Transform>(villagerPoints);

        /// Generar Ladrón
        // Obtener datos aleatorios
        int        randomNumber   = Random.Range(0, updatedVillagerPoints.Count);
        Transform  randomPoint    = updatedVillagerPoints[randomNumber];
        Quaternion randomRotation = Quaternion.Euler(0, Random.Range(0, 360), 0);

        // Instanciar objeto
        GameObject thiefGameObject = Instantiate(thiefPrefab, randomPoint.position, randomRotation, villagersParent.transform);

        // Obtener componente Villager
        Thief newThief = thiefGameObject.GetComponent <Thief>();

        // Se aleatoriza
        newThief.RandomizeNPC();

        // Instanciamos sus objetos
        newThief.PutItems();

        // Asignar a la referencia
        thief = newThief;

        // Borrar posición de la lista
        updatedVillagerPoints.Remove(randomPoint);

        /// Generar aldeanos
        for (int i = 0; i < (difficulty.villagers - 1); i++)
        {
            // Obtener datos aleatorios
            randomNumber   = Random.Range(0, updatedVillagerPoints.Count);
            randomPoint    = updatedVillagerPoints[randomNumber];
            randomRotation = Quaternion.Euler(0, Random.Range(0, 360), 0);

            // Instanciar objeto
            GameObject villagerGameObject = Instantiate(villagerPrefab, randomPoint.position, randomRotation, villagersParent.transform);

            // Obtener componente Villager
            Villager newVillager = villagerGameObject.GetComponent <Villager>();

            // Aleatorizamos el aldeano y comprobamos si ya existe uno igual
            do
            {
                newVillager.RandomizeNPC();
            } while (CheckDuplicateVillager(newVillager));

            // Instanciamos sus objetos
            newVillager.PutItems();

            // Añadimos al aldeano a la lista
            villagers.Add(newVillager);

            // Borrar posición de la lista
            updatedVillagerPoints.Remove(randomPoint);
        }
    }
Пример #18
0
    void BeStolen(Thief t)
    {
        Dictionary <int, int> target = new Dictionary <int, int> ();

        int totalValue = 0;        //计算总价值

        foreach (int key in GameData._playerData.wh.Keys)
        {
            totalValue += LoadTxt.MatDic [(int)(key / 10000)].price * GameData._playerData.wh [key];
        }

        int max   = (int)(10000f / GameData._playerData.wh.Count);      //把仓库物品分成max份
        int num   = 0;
        int value = 0;
        int i     = 1;

        foreach (int key in GameData._playerData.wh.Keys)
        {
            int r = Algorithms.GetIndexByRange(0, 10000);
            if (r < i * max && r > ((i - 1) * max))
            {
                float f = Algorithms.GetIndexByRange(0, 30) / 100f * GameData._playerData.wh [key];
                f *= GameData._playerData.TheftLossDiscount;

                num = (int)Mathf.Round(f);
                if (num > 0)
                {
                    target.Add(key, num);
                    value += LoadTxt.MatDic [(int)(key / 10000)].price * num;
                }
            }

            //价值保护
            if (value >= totalValue * 0.2f || value >= 2000)
            {
                break;
            }
        }
        _gameData.DeleteItemInWh(target);
        string s = "";

        foreach (int key in target.Keys)
        {
            s += LoadTxt.MatDic [(int)(key / 10000)].name + " -" + target [key] + ",";
        }
        if (s != "")
        {
            s = s.Substring(0, s.Length - 1) + "。";
            _logManager.AddLog("Warning!" + t.name + "robbed your house." + s);
        }
        else
        {
            _logManager.AddLog("Warning!" + t.name + "robbed your house, but got nothing.");
        }
        _logManager.AddLog("You should upgrade techs or arrange better guards.");
    }
Пример #19
0
        /// <summary>
        /// Private helper method (to be refactored/potentially moved) that
        /// allows the creation of a Party of heroes (currently allows 3 members).
        /// </summary>
        private void CreateQuestParty()
        {
            //Input help information - print to the console
            Console.WriteLine();
            Console.WriteLine("Create your Party (BRW = Brawler, CLR = Cleric, MAG = Mage, NEC = Necromancer, THF = Thief)...");

            //Loop three times and allow the creation of the relevant heroes
            for (int i = 0; i < 3; i++)
            {
                //Create a new hero (based on user selection)
                Console.WriteLine();
                Console.Write("Choose your hero number {0}: ", i);
                Hero newHero = null;

                switch (Utils.InterpretUserInput(Console.ReadLine()))
                {
                case GameAction.ClericChosen:
                {
                    newHero = new Cleric();
                }
                break;

                case GameAction.MageChosen:
                {
                    newHero = new Mage();
                }
                break;

                case GameAction.NecromancerChosen:
                {
                    newHero = new Necromancer();
                }
                break;

                case GameAction.ThiefChosen:
                {
                    newHero = new Thief();
                }
                break;

                case GameAction.BrawlerChosen:
                default:
                {
                    newHero = new Brawler();
                }
                break;
                }

                //Safety check - Only add the hero if it's set correctly
                if (newHero != null)
                {
                    partyMembers.Add(newHero);
                    Console.WriteLine("{0} added to the Party.", newHero.GetType().Name);
                }
            }
        }
Пример #20
0
    void Start()
    {
        Transform playerwrap = GameObject.FindGameObjectWithTag("Player").transform;

        player      = playerwrap.GetComponent <Thief> ();
        target      = playerwrap.transform.FindChild("fpcontrol");
        playerlayer = LayerMask.NameToLayer("player");
        //light = transform.GetChild (0).gameObject;
        StartCoroutine("work", .5f);
    }
Пример #21
0
 public Abilities(int immunityLevel, int treatsGaloreLevel, int fearlessLevel, int fatMouseLevel, int scaryCatLevel, int beastlyBuffetLevel, int thiefLevel)
 {
     Immunity = new Immunity(immunityLevel);
     TreatsGalore = new TreatsGalore(treatsGaloreLevel);
     Fearless = new Fearless(fearlessLevel);
     FatMouse = new FatMouse(fatMouseLevel);
     ScaryCat = new ScaryCat(scaryCatLevel);
     BeastlyBuffet = new BeastlyBuffet(beastlyBuffetLevel);
     Thief = new Thief(thiefLevel);
 }
Пример #22
0
    public override void Awake()
    {
        base.Awake();

        thiefMain = GetComponent <Thief>();

        sprites     = thiefMain.sprites;
        srAlphas    = new float[sprites.Length];
        srAlphas[0] = sprites[0].color.a;
    }
Пример #23
0
 public override void Start()
 {
     base.Start();
     playerwrap = GameObject.FindGameObjectWithTag("Player").transform;
     //inventory = playerwrap.GetComponent<Inventory> ();
     droppos    = Camera.main.transform.FindChild("drop");
     baseweight = weight;
     info       = "take " + objname;
     setpopup(info);
     player = playerwrap.GetComponent <Thief> ();
 }
        public void Thief_MultipleItemCapacity_MultipleDifferentStolenObjects()
        {
            _thief = new Thief(this, _map, new ThiefDesires(_map.SpatialValuables), 2);
            _layer[0, 0].Put(_upFacingValuable);
            _layer[2, 2].Put(_valuable2);

            PerformRobbery();

            Assert.AreEqual(2, _stolenLocations.Count);
            Assert.AreNotEqual(_stolenLocations.First(), _stolenLocations.Last());
        }
Пример #25
0
    //NoThrough nt;

    public void Start()
    {
        player = GameObject.FindGameObjectWithTag("Player").GetComponent <Thief> ();
        hold   = player.hold;
        //holdfar = player.holdfar;
        cam       = player.cam;
        holdrange = player.holdrange;
        rb        = GetComponent <Rigidbody> ();
        //lev = GetComponent<Levitate> ();
        //nt = GetComponent<NoThrough> ();
    }
Пример #26
0
    public void OnEndBattle()
    {
        FindObjectOfType <DialogueManager>().StartDialogue(AfterDialogue, this);

        Thief thief = GetComponent <Thief>();

        if (thief != null)
        {
            thief.IsDefeated = true;
        }
    }
Пример #27
0
        public void GetSpecialAttackThiefFailTest()
        {
            //arrange
            Thief vTest = new Thief("SneaKy", "Thief", 10, 50);

            //act
            int vResults = vTest.GetSpecialAttack();

            //assert
            Assert.AreEqual(5, vResults);
        }
Пример #28
0
 void Start()
 {
     //FollowPathCorotine = FollowPath();
     currTarget = treasure;
     currSpeed  = initialSpeed;
     //InvokeRepeating("RefindPath", 0f, 0.5f);
     thief = GetComponent <Thief>();
     //mIsAllowFollow = true;
     //PathRequestManager.RequestPath(transform.position, currTarget.position, OnPathFound);
     SortEscapePoints();
 }
        public void Init()
        {
            _thief = new Thief(this, _map);
            _thief.Subscribe(this);
            var builder = new LayerBuilder(3, 3);

            builder.PutFloor(new XY(0, 0), new XY(2, 2));
            AddPortals(builder);
            _map.Add(_layer = builder.Build());
            _upFacingContainer.Put(_upFacingValuable);
            _rightFacingContainer.Put(_valuable2);
        }
Пример #30
0
        public Thief ToThief()
        {
            var thief = new Thief(Id, UserName, InviteKey, Location, Status, Gadgets, TriggeredAlarm, CaughtAt);

            if (FakePolice)
            {
                return(new FakePolice(thief));
            }
            else
            {
                return(thief);
            }
        }
Пример #31
0
    public override void Start()
    {
        base.Start();
        player = GameObject.FindGameObjectWithTag("Player").GetComponent <Thief> ();
        trywrap.gameObject.SetActive(false);
        hackwrap.gameObject.SetActive(false);
        rightwrap.gameObject.SetActive(false);

        /*up = player.ctrl.up;
         * down = player.ctrl.down;
         * left = player.ctrl.left;
         * right = player.ctrl.right;*/
    }
Пример #32
0
        public void ThiefTest()
        {
            //arrange
            Thief vTest = new Thief("SneaKy", "Thief", 10, 50);

            //act

            //assert
            Assert.AreEqual("SneaKy", vTest.characterName);
            Assert.AreEqual(10, vTest.baseDamage);
            Assert.AreEqual(50, vTest.currentHealthPoints);
            Assert.AreEqual(50, vTest.maxHealthPoints);
        }
        public void Produce(IEnumerable<Tile> level)
        {
            while (this.enemies.Count < Constants.MaxEnemies)
            {
                int randomEnemy = this.Generator.Next(1, 3);
                Vector2 newPosition = ChoosePosition(level);

                Enemy newEnemy = null;

                switch (randomEnemy)
                {
                    case (int)Enemies.Thief:
                        newEnemy = new Thief(newPosition);
                        break;
                    case (int)Enemies.Dwarf:
                        newEnemy = new Dwarf(newPosition);
                        break;
                }

                this.enemies.Add(newEnemy);
            }
        }
Пример #34
0
 /// <summary>
 /// Method to set a player's ability to a certain level.
 /// </summary>
 /// <param name="ability">Ability to be changed</param>
 /// <param name="level">New level</param>
 public void SetAbility(AbilityName ability, int level)
 {
     switch (ability)
     {
         case AbilityName.Immunity:
             Immunity = new Immunity(level);
             break;
         case AbilityName.TreatsGalore:
             TreatsGalore = new TreatsGalore(level);
             break;
         case AbilityName.Fearless:
             Fearless = new Fearless(level);
             break;
         case AbilityName.FatMouse:
             FatMouse = new FatMouse(level);
             break;
         case AbilityName.ScaryCat:
             ScaryCat = new ScaryCat(level);
             break;
         case AbilityName.BeastlyBuffet:
             BeastlyBuffet = new BeastlyBuffet(level);
             break;
         case AbilityName.Thief:
             Thief = new Thief(level);
             break;
         default:
             throw new ArgumentOutOfRangeException("ability", ability, "No such ability.");
     }
 }
Пример #35
0
        /// <summary>
        /// Creates a new card based on how many cards have already been made.
        /// </summary>
        /// <param name="card">
        /// The name of the card to be created.
        /// </param>
        /// <returns>
        /// The new created card.
        /// </returns>
        public static Card CreateCard(CardName card)
        {
            Contract.Requires(card != CardName.Backside & card != CardName.Empty);

            Contract.Ensures(Contract.Result<Card>().Name == card);

            Card c;
            switch (card)
            {
                case CardName.Copper:
                    c = new Copper();
                    break;
                case CardName.Silver:
                    c = new Silver();
                    break;
                case CardName.Gold:
                    c = new Gold();
                    break;
                case CardName.Curse:
                    c = new Curse();
                    break;
                case CardName.Estate:
                    c = new Estate();
                    break;
                case CardName.Duchy:
                    c = new Duchy();
                    break;
                case CardName.Province:
                    c = new Province();
                    break;
                case CardName.Gardens:
                    c = new Gardens();
                    break;
                case CardName.Cellar:
                    c = new Cellar();
                    break;
                case CardName.Chapel:
                    c = new Chapel();
                    break;
                case CardName.Chancellor:
                    c = new Chancellor();
                    break;
                case CardName.Village:
                    c = new Village();
                    break;
                case CardName.Woodcutter:
                    c = new Woodcutter();
                    break;
                case CardName.Workshop:
                    c = new Workshop();
                    break;
                case CardName.Feast:
                    c = new Feast();
                    break;
                case CardName.Moneylender:
                    c = new Moneylender();
                    break;
                case CardName.Remodel:
                    c = new Remodel();
                    break;
                case CardName.Smithy:
                    c = new Smithy();
                    break;
                case CardName.ThroneRoom:
                    c = new ThroneRoom();
                    break;
                case CardName.CouncilRoom:
                    c = new CouncilRoom();
                    break;
                case CardName.Festival:
                    c = new Festival();
                    break;
                case CardName.Laboratory:
                    c = new Laboratory();
                    break;
                case CardName.Library:
                    c = new Library();
                    break;
                case CardName.Market:
                    c = new Market();
                    break;
                case CardName.Mine:
                    c = new Mine();
                    break;
                case CardName.Adventurer:
                    c = new Adventurer();
                    break;
                case CardName.Bureaucrat:
                    c = new Bureaucrat();
                    break;
                case CardName.Militia:
                    c = new Militia();
                    break;
                case CardName.Spy:
                    c = new Spy();
                    break;
                case CardName.Thief:
                    c = new Thief();
                    break;
                case CardName.Witch:
                    c = new Witch();
                    break;
                case CardName.Moat:
                    c = new Moat();
                    break;
                default:
                    throw new NotImplementedException("Tried to create a card that was not implemented when CardFactory was last updated.");
            }

            c.Initialize(card, CardsMade[card]);
            CardsMade[card] += 1;
            createdCards.Add(c, true);
            return c;
        }
Пример #36
0
 public Mission(Thief theThief, MissionType mType, List<Point> pts)
 {
     thief = theThief;
     type=mType;
     targets = pts;
 }
Пример #37
0
    /// <summary>
    /// Synchronizes with the server, then calls run().
    /// </summary>
    /// <returns>
    /// Return true to end turn, false to resynchronize with the 
    /// server and run again.
    /// </returns>
    public bool startTurn()
    {
        int count = 0;
        iteration++;

        count = Client.getPlayerCount(connection);
        players = new Player[count];
        for(int i = 0; i < count; i++)
          players[i] = new Player(Client.getPlayer(connection, i));

        count = Client.getMappableCount(connection);
        mappables = new Mappable[count];
        for(int i = 0; i < count; i++)
          mappables[i] = new Mappable(Client.getMappable(connection, i));

        count = Client.getTileCount(connection);
        tiles = new Tile[count];
        for(int i = 0; i < count; i++)
          tiles[i] = new Tile(Client.getTile(connection, i));

        count = Client.getTrapCount(connection);
        traps = new Trap[count];
        for(int i = 0; i < count; i++)
          traps[i] = new Trap(Client.getTrap(connection, i));

        count = Client.getThiefCount(connection);
        thiefs = new Thief[count];
        for(int i = 0; i < count; i++)
          thiefs[i] = new Thief(Client.getThief(connection, i));

        count = Client.getThiefTypeCount(connection);
        thiefTypes = new ThiefType[count];
        for(int i = 0; i < count; i++)
          thiefTypes[i] = new ThiefType(Client.getThiefType(connection, i));

        count = Client.getTrapTypeCount(connection);
        trapTypes = new TrapType[count];
        for(int i = 0; i < count; i++)
          trapTypes[i] = new TrapType(Client.getTrapType(connection, i));

        if(!initialized)
        {
          initialized = true;
          init();
        }

        return run();
    }
Пример #38
0
	public void convertThief(NPC npc){
		if (ressource.gold >= 2 && ressource.blood>=2) {
			ressource.gold -= 2;
			ressource.blood -= 2;

			int position = npc.position;
			npc = new Thief ();
			npc.setPosition (position);
			this.party.addNPC (npc);
		}
	}
    void Start()
    {
        controller = GetComponent<CharacterController>();
        jumping = false;
        fallen = false;
        previousGroundedY = transform.position.y;

        thief = GetComponent<Thief>();
        murderer = GetComponent<Murderer>();
        cheater = GetComponent<Cheater>();
        addict = GetComponent<Addict>();
        liar = GetComponent<Liar>();

        thief.enabled = false;
        murderer.enabled = false;
        cheater.enabled = false;
        addict.enabled = false;
        liar.enabled = false;

        numPowerUps = 0;
    }