Inheritance: MonoBehaviour
Ejemplo n.º 1
0
 void Start()
 {
     cam    = GetComponentInChildren <Camera>().transform;
     motor  = GetComponent <CharacterMotor>();
     weapon = GetComponent <WeaponHolder>();
     hunter = GetComponent <Hunter>();
 }
Ejemplo n.º 2
0
    public void OnHunterSpawned(Hunter in_hunter)
    {
        int playerIndex = hunterGOs.Count;

        hunterGOs.Add(in_hunter.gameObject);
        in_hunter.SetPlayerIndex((uint)playerIndex);
    }
Ejemplo n.º 3
0
    private void exchangeNumbers(int i, int j)
    {
        Hunter temp = hunterList[i];

        hunterList[i] = hunterList[j];
        hunterList[j] = temp;
    }
Ejemplo n.º 4
0
    private IEnumerator Wait4MeToDie()
    {
        yield return(new WaitForSeconds(1));

        Destroy(this.gameObject);
        Hunter.givePoints(20);
    }
Ejemplo n.º 5
0
        public static void InitializeRules(Hunter hunter)
        {
            FuzzyModule module = hunter.GetFuzzyModule();

            Stamina     = module.CreateFuzzyVariable(Stamina_Name);
            Experiance  = module.CreateFuzzyVariable(Experiance_Name);
            TinderUsage = module.CreateFuzzyVariable(TinderUsage_Name);

            Stamina_Low     = Stamina.AddLeftShoulderSet(Stamina_Low_Name, 0, 25.0, 50.0);
            Stamina_Average = Stamina.AddTriangularSet(Stamina_Average_Name, 25.0, 50.0, 75.0);
            Stamina_High    = Stamina.AddRightShoulderSet(Stamina_High_Name, 50.0, 75.0, 100.0);

            Experiance_Low     = Experiance.AddLeftShoulderSet(Experiance_Low_Name, 0.0, 25, 50);
            Experiance_Average = Experiance.AddTriangularSet(Experiance_Average_Name, 25, 50, 75);
            Experiance_High    = Experiance.AddRightShoulderSet(xperiance_High_Name, 50, 75, 100);

            TinderUsage_Low     = TinderUsage.AddLeftShoulderSet(TinderUsage_Low_Name, 0, 2.5, 5);
            TinderUsage_Average = TinderUsage.AddTriangularSet(TinderUsage_Average_Name, 2.5, 5, 7.5);
            TinderUsage_High    = TinderUsage.AddRightShoulderSet(TinderUsage_High_Name, 5, 7.5, 10);

            module.AddRule(new FuzzyAND(Stamina_Low, Experiance_Low), TinderUsage_High);
            module.AddRule(new FuzzyAND(Stamina_Low, Experiance_Average), TinderUsage_High);
            module.AddRule(new FuzzyAND(Stamina_Low, Experiance_High), TinderUsage_Average);

            module.AddRule(new FuzzyAND(Stamina_Average, Experiance_Low), TinderUsage_High);
            module.AddRule(new FuzzyAND(Stamina_Average, Experiance_Average), TinderUsage_Average);
            module.AddRule(new FuzzyAND(Stamina_Average, Experiance_High), TinderUsage_Low);

            module.AddRule(new FuzzyAND(Stamina_High, Experiance_Low), TinderUsage_Average);
            module.AddRule(new FuzzyAND(Stamina_High, Experiance_Average), TinderUsage_Average);
            module.AddRule(new FuzzyAND(Stamina_High, Experiance_High), TinderUsage_Low);
        }
Ejemplo n.º 6
0
    public override bool checkProceduralPrecondition(GameObject agent)
    {
        Hunter hunter = (Hunter)agent.GetComponent(typeof(Hunter));

        if (hunter.actualPrey != null)
        {
            float posX = hunter.actualPrey.transform.position.x - 2f;
            if (hunter.actualPrey.transform.position.x < agent.transform.position.x)
            {
                posX = hunter.actualPrey.transform.position.x + 2f;
            }

            float posY = hunter.actualPrey.transform.position.y - 2f;
            if (hunter.actualPrey.transform.position.y < agent.transform.position.y)
            {
                posY = hunter.actualPrey.transform.position.y + 2f;
            }

            nextPosition   = new Vector3(posX, posY, agent.transform.position.z);
            targetPosition = nextPosition;
            Debug.DrawLine(targetPosition, agent.transform.position, Color.black, 3, false);
        }

        return(hunter.actualPrey != null);
    }
        private async void InitializeViewModel()
        {
            FirstConnectionPage.FirstConnectionUC.User_name.Content = MainWindow.Instance.CurrentUser.Name;

            GearBases = await AGearBaseRoutes.GetAllGearBases();

            Gears    = new Gear[3];
            Gears[0] = GearBases.Find(x => x.Name == "Knife").ToGear();
            Gears[1] = GearBases.Find(x => x.Name == "Bow").ToGear();
            Gears[2] = GearBases.Find(x => x.Name == "Staff").ToGear();

            CharactersListM    = new ICharacter[3];
            CharactersListM[0] = new Warrior("M", true);
            CharactersListM[1] = new Hunter("M", true);
            CharactersListM[2] = new Magus("M", true);

            CharactersListF    = new ICharacter[3];
            CharactersListF[0] = new Warrior("F", true);
            CharactersListF[1] = new Hunter("F", true);
            CharactersListF[2] = new Magus("F", true);

            CurrentIndex = 0;
            IsFemale     = false;
            Render();
        }
    IEnumerator Procreate(Hunter other)
    {
        canProcreate = false;

        float to = Time.time + ProcreationTime;

        while (other != null && (other.transform.position - transform.position).magnitude < SightDistance)
        {
            if (Time.time > to)
            {
                if (UnityEngine.Random.Range(0f, 1f) < ProcreationProbability)
                {
                    if (transform.GetSiblingIndex() < other.transform.GetSiblingIndex())
                    {
                        SimulationManager.Instance.MakeABaby(this, other);
                    }

                    canProcreate = true;
                }
                else
                {
                    yield return(new WaitForSeconds(cooldowntime));

                    canProcreate = true;
                }

                break;
            }

            yield return(null);
        }

        canProcreate = true;
    }
        // Get: Hunters/Void/5
        public IActionResult Void(int id, string answer = null)
        {
            //Debug.WriteLine("----------------------------User--->" + User.FindFirst(ClaimTypes.NameIdentifier).Subject.ToString());
            //Debug.WriteLine("----------------------------User--->" + _manager.GetUserName(User));
            string    email     = _manager.GetUserName(User);
            Hunter    hunter    = _context.Hunters.FirstOrDefault(h => h.Email == email);
            Butterfly butterfly = _context.Butterflies.FirstOrDefault(b => b.Id == id);
            Vote      vote      = new Vote()
            {
                Butterfly = butterfly, Hunter = hunter
            };

            //Debug.WriteLine("----->>>>>" + hunter.Name + "<<<<<");
            if (answer == null)
            {
                return(View(vote));
            }
            else
            {
                if (answer == "yes")
                {
                    hunter.Voted      = true;
                    butterfly.Ranking = butterfly.Ranking + 1;
                    _context.SaveChanges();
                }
                return(Redirect("~/Butterflies"));
            }
        }
Ejemplo n.º 10
0
    // Use this for initialization
    void Start()
    {
        Hero mage, hunter;

        mage   = new Mage();
        hunter = new Hunter();

        ArrayList mageDeck, hunterDeck;

        mageDeck   = returnMageDeck();
        hunterDeck = returnHunterDeck();

        Board board = new Board(ref mageDeck, ref hunterDeck, ref mage, ref hunter);

        board.nextTurn();

        foreach (Card c in board.curr.hand)
        {
            Debug.Log(c.name);
        }

        /**if()
         * board.play (0);
         * board.play (board.curr.opponent, 0);
         */
    }
        public async Task <IActionResult> Edit(int id, [Bind("HunterId,Name,Email,Voted,Display")] Hunter hunter)
        {
            if (id != hunter.HunterId)
            {
                //Debug.WriteLine("--------in----------hunter->" + hunter.HunterId + "---" + id + "<-");
                return(Content("--hunter->" + hunter.HunterId + "<--->" + id + " < -"));
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(hunter);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!HunterExists(hunter.HunterId))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            return(View(hunter));
        }
Ejemplo n.º 12
0
        public Spells(Hunter newHunterSpells)
        {
            this.hunterSpells = newHunterSpells;

            if (hunterSpells.Equals(Hunter.SteadyShot))
            {
                this.spellName   = "Steady shot";
                this.spellValue  = 165;
                this.spellClass  = new Classes(Classes.Class.Hunter);
                this.kindOfSpell = KindOfSpell.Damage;
                this.mana        = 30;
            }
            if (hunterSpells.Equals(Hunter.FireTrap))
            {
                this.spellName   = "Fire trap";
                this.spellValue  = 190;
                this.spellClass  = new Classes(Classes.Class.Hunter);
                this.kindOfSpell = KindOfSpell.Damage;
                this.mana        = 50;
            }
            if (hunterSpells.Equals(Hunter.ChimeraShot))
            {
                this.spellName   = "Chimera shot";
                this.spellValue  = 600;
                this.spellClass  = new Classes(Classes.Class.Hunter);
                this.kindOfSpell = KindOfSpell.Damage;
                this.mana        = 80;
            }
        }
    void OnCollisionEnter(Collision other)
    {
        Hunter otherHunter = other.gameObject.GetComponent <Hunter>();

        if (otherHunter != null)
        {
            if (otherHunter.HunterType != HunterType)
            {
                Vector3 dir = -(other.contacts[0].point - transform.position).normalized;
                rb.AddForce(dir * 1000f);

                otherHunter.TakeDamage(Attack, false, GainStats);
            }
            else
            {
                if (canProcreate)
                {
                    if (procreationCoroutine != null)
                    {
                        StopCoroutine(procreationCoroutine);
                    }

                    procreationCoroutine = StartCoroutine(Procreate(otherHunter));
                }
            }
        }
    }
Ejemplo n.º 14
0
    //Constant movement update
    void Update()
    {
        transform.Translate(Vector2.right * speed * Time.deltaTime);
        RaycastHit2D groundInfo = Physics2D.Raycast(groundDetection.position, Vector2.down, distance);

        if (groundInfo.collider == false)
        {
            if (movingRight)
            {
                transform.eulerAngles = new Vector3(0, -180, 0);
                movingRight           = false;
            }
            else
            {
                transform.eulerAngles = new Vector3(0, 0, 0);
                movingRight           = true;
            }
        }

        if (health <= 0)
        {
            Destroy(this.gameObject);
            Hunter.givePoints(10);
        }
    }
Ejemplo n.º 15
0
        private List <string> LoadSubdomains(string url)
        {
            string testUrl    = url.Trim(new char[] { '*', '.' });
            var    subDomains = new List <string>();

            //This will have to get moved to a central db
            List <string> knownSubdomains = new List <string>();
            string        existingFile    = Path.Combine(Settings.ExistingDir, testUrl.Replace(".", "") + ".txt");

            if (File.Exists(existingFile))
            {
                knownSubdomains = File.ReadAllLines(existingFile).ToList();
            }

            HunterRequest request = new HunterRequest();

            request.Domain               = testUrl;
            request.KnownSubdomains      = knownSubdomains;
            request.SecurityTrailsAPIKey = Settings.SecurityTrailsAPI;
            request.VirusTotalAPIKey     = Settings.VirusTotalAPI;

            subDomains = Hunter.GatherAll(request);

            Log("Subdomains found: " + subDomains.Count);
            TextFileLogger.WriteOverwriteFile(Settings.ExistingDir, testUrl.Replace(".", "") + ".txt", subDomains);

            return(subDomains);
        }
Ejemplo n.º 16
0
        private static void StartChase(ILivingCreature animal)
        {
            var    pray   = animal as Animal;
            Hunter hunter = new Hunter();

            hunter.Chase(pray);
        }
Ejemplo n.º 17
0
    public void Initiate()
    {
        TheHunter       = Instantiate(HunterPrefab, new Vector3(0f, 3f, 0f), Quaternion.identity);
        TheHunter.Speed = HunterSpeed;

        TheGridManager.GenerateGrid(false);
        hunterVisionGrids = new List <Vector2Int>();
        monsterObjs       = new List <Monster>();

        for (int i = 0; i < InitialMonster; i++)
        {
            SpawnMonster();
        }

        if (HumanControlEnabled)
        {
            GameObject hunterCtlObj = new GameObject("HunterController");
            hunterCtlObj.transform.parent = transform;
            hunterController = hunterCtlObj.AddComponent <HunterController>();
            hunterController.ProjectileDistance = HunterProjectileDistance;
            hunterController.ProjectileSpeed    = HunterProjectileSpeed;
            hunterController.IsEnabled          = HumanControlEnabled;
            hunterController.TheHunter          = TheHunter;
        }

        if (SdkAiEnabled)
        {
            hunterSDK = new HunterSDK <State, StepResponse>(this, SdkHost);
            hunterSDK.Initiate();
            InvokeRepeating("Step", 2.0f, SdkStepInterval);
        }

        initiated = true;
    }
Ejemplo n.º 18
0
 public void SetTarget(Hunter target,Transform target_ui_potision)
 {
     current_target_hunter = target;
     this.transform.SetParent(target_ui_potision);
     this.GetComponent<RectTransform>().anchoredPosition = Vector2.zero;
     SetInteractable(true);
 }
Ejemplo n.º 19
0
        public override void Initialize()
        {
            // create and add any components that belong to this scene
            this.AddComponent(new Background(Game));

            this.AddComponent(new Score(Game, "fonts\\hudFont", HudLocation.TopRight));

            this.AddComponent(new AnimalsDead(Game, "fonts\\hudFont", HudLocation.TopLeft));


            AnimalManager animalManager = new AnimalManager(Game);

            this.AddComponent(animalManager);
            Game.Services.AddService <AnimalManager>(animalManager);

            TrashManager trashManager = new TrashManager(Game);

            this.AddComponent(trashManager);
            Game.Services.AddService <TrashManager>(trashManager);

            Hunter hunter = new Hunter(Game);

            this.AddComponent(hunter);
            Game.Services.AddService <Hunter>(hunter);

            base.Initialize();
        }
Ejemplo n.º 20
0
        public async Task <IHttpActionResult> PutHunter(int id, Hunter hunter)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            if (id != hunter.HunterId)
            {
                return(BadRequest());
            }

            db.Entry(hunter).State = EntityState.Modified;

            try
            {
                await db.SaveChangesAsync();
            }
            catch (DbUpdateConcurrencyException)
            {
                if (!HunterExists(id))
                {
                    return(NotFound());
                }
                else
                {
                    throw;
                }
            }

            return(StatusCode(HttpStatusCode.NoContent));
        }
 public void HunterEvent(Hunter hunter, HunterEventType type)
 {
     if (type == HunterEventType.Died)
     {
         UIManager.Instance.UpdateHunterText();
     }
 }
Ejemplo n.º 22
0
        private void _btnStart_Click(object sender, EventArgs e)
        {
            string firstUrl = _txtURL.Text;

            if (String.IsNullOrEmpty(firstUrl))
            {
                MessageBox.Show("Enter a url.");
                return;
            }

            List <string> urls = new List <string>();

            List <string> urlsToTest = new List <string>();

            if (firstUrl.StartsWith("*"))
            {
                //Load subdomains
                HunterRequest hr = new HunterRequest();
                hr.Domain  = firstUrl.TrimStart('*').TrimStart('.');
                urlsToTest = Hunter.GatherAll(hr);

                //urlsToTest = new List<string>() { "www.neopets.com" };
            }
            else
            {
                urlsToTest.Add(firstUrl);
            }

            _bgwScanner.DoWork             += new DoWorkEventHandler(_bgwScanner_DoWork);
            _bgwScanner.RunWorkerCompleted += new RunWorkerCompletedEventHandler(_bgwScanner_RunWorkerCompleted);

            _bgwScanner.RunWorkerAsync(urlsToTest);
        }
        public async Task <IHttpActionResult> PostHuntedAnimalPoints(HuntedAnimal huntedAnimal)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }



            var animalList = db.Animals.Where(a => a.AnimalId == huntedAnimal.Animal.AnimalId).ToList();

            animal = animalList[0];
            var hunterlist = db.Hunters.Where(h => h.HunterId == 1).ToList();

            hunter = hunterlist[0];

            huntedAnimal.Hunter = hunter;
            huntedAnimal.Animal = animal;



            db.HuntedAnimals.Add(huntedAnimal);
            await db.SaveChangesAsync();

            return(CreatedAtRoute("DefaultApi", new { id = huntedAnimal.HuntedAnimalId }, huntedAnimal));
        }
Ejemplo n.º 24
0
        public void Observable_Where_Move_Parameter_WindowWidth_LessThan_X_And_WindowHeight_LessThan_Y()
        {
            Hunter observable = new Hunter(50, 100, 1000, 500, 10, 3, new Publisher());

            Assert.ThrowsException <ArgumentOutOfRangeException>(
                () => observable.Move(DirectionType.Up, 10, 10));
        }
Ejemplo n.º 25
0
        public void PopulateGameboard()
        {
            GamePiece birdOne               = new GamePiece("Bird 1", 10, 0, 0, false, false);
            GamePiece birdTwo               = new GamePiece("Bird 2", 10, 0, 0, false, false);
            GamePiece birdThree             = new GamePiece("Bird 3", 10, 0, 0, false, false);
            GamePiece birdFour              = new GamePiece("Bird 4", 10, 0, 0, false, false);
            GamePiece CrestedIbis           = new GamePiece("Crested Ibis", 100, 0, 0, false, false);
            GamePiece GreatKiskudee         = new GamePiece("Great Kiskudee", 300, 0, 0, false, false);
            GamePiece RedCrossbill          = new GamePiece("Red Crossbill", 500, 0, 0, false, false);
            GamePiece RedNeckedPhalarope    = new GamePiece("Red-Necked Phalarope", 700, 0, 0, false, false);
            GamePiece EveningGrosbeak       = new GamePiece("Evening Grosbeak", 1000, 0, 0, false, false);
            GamePiece GreaterPrairieChicken = new GamePiece("Greater Prairie Chicken", 2000, 0, 0, false, false);
            GamePiece IcelandGull           = new GamePiece("Iceland Gull", 3000, 0, 0, false, false);
            GamePiece OrangeBelliedParrot   = new GamePiece("Orange-Bellied Parrot", 5000, 0, 0, false, false);
            Hunter    BirdHunterOne         = new Hunter("Bird Hunter 1", 200, 0, 0, false, false, 0);
            Hunter    BirdHunterTwo         = new Hunter("Bird Hunter 2", 200, 0, 0, false, false, 0);
            Hunter    BirdHunterThree       = new Hunter("Bird Hunter 3", 200, 0, 0, false, false, 0);
            Hunter    BirdHunterFour        = new Hunter("Bird Hunter 4", 200, 0, 0, false, false, 0);
            GamePiece Stopper               = new GamePiece("Stopper", 0, 0, 0, false, false);
            Player    Drofsnar              = new Player("Drofsnar", 0, 0, 0, false, false, 3, 0, 0);

            _gameBoardRepo.AssignRandomCoordinates(birdOne);
            _gameBoardRepo.AssignRandomCoordinates(birdTwo);
            _gameBoardRepo.AssignRandomCoordinates(birdThree);
            _gameBoardRepo.AssignRandomCoordinates(birdFour);
            _gameBoardRepo.AssignRandomCoordinates(CrestedIbis);
            _gameBoardRepo.AssignRandomCoordinates(GreatKiskudee);
            _gameBoardRepo.AssignRandomCoordinates(RedCrossbill);
            _gameBoardRepo.AssignRandomCoordinates(RedNeckedPhalarope);
            _gameBoardRepo.AssignRandomCoordinates(EveningGrosbeak);
            _gameBoardRepo.AssignRandomCoordinates(GreaterPrairieChicken);
            _gameBoardRepo.AssignRandomCoordinates(IcelandGull);
            _gameBoardRepo.AssignRandomCoordinates(OrangeBelliedParrot);
            _gameBoardRepo.AssignRandomCoordinates(BirdHunterOne);
            _gameBoardRepo.AssignRandomCoordinates(BirdHunterTwo);
            _gameBoardRepo.AssignRandomCoordinates(BirdHunterThree);
            _gameBoardRepo.AssignRandomCoordinates(BirdHunterFour);
            _gameBoardRepo.AssignRandomCoordinates(Stopper);
            _gameBoardRepo.AssignRandomCoordinates(Drofsnar);


            _gameBoardRepo.PlacePieceOnGameBoard(birdOne);
            _gameBoardRepo.PlacePieceOnGameBoard(birdTwo);
            _gameBoardRepo.PlacePieceOnGameBoard(birdThree);
            _gameBoardRepo.PlacePieceOnGameBoard(birdFour);
            _gameBoardRepo.PlacePieceOnGameBoard(CrestedIbis);
            _gameBoardRepo.PlacePieceOnGameBoard(GreatKiskudee);
            _gameBoardRepo.PlacePieceOnGameBoard(RedCrossbill);
            _gameBoardRepo.PlacePieceOnGameBoard(RedNeckedPhalarope);
            _gameBoardRepo.PlacePieceOnGameBoard(EveningGrosbeak);
            _gameBoardRepo.PlacePieceOnGameBoard(GreaterPrairieChicken);
            _gameBoardRepo.PlacePieceOnGameBoard(IcelandGull);
            _gameBoardRepo.PlacePieceOnGameBoard(OrangeBelliedParrot);
            _gameBoardRepo.PlacePieceOnGameBoard(BirdHunterOne);
            _gameBoardRepo.PlacePieceOnGameBoard(BirdHunterTwo);
            _gameBoardRepo.PlacePieceOnGameBoard(BirdHunterThree);
            _gameBoardRepo.PlacePieceOnGameBoard(BirdHunterFour);
            _gameBoardRepo.PlacePieceOnGameBoard(Stopper);
            _gameBoardRepo.PlacePieceOnGameBoard(Drofsnar);
        }
Ejemplo n.º 26
0
    IEnumerator HunterAttack(Hunter target)
    {
        ToggleAbilityControl();
        StartCoroutine(blackout.FadeInBlack());
        bool succeeded = false;

        StopTime();
        TakedownGame minigame = TakedownGame.GetRandGame();

        if (minigame == null)
        {
            print("No Game Received!");
            yield break;
        }
        minigame.drone = false;
        minigame.BeginGame();
        while (!minigame.CheckFinished(ref succeeded))
        {
            yield return(new WaitForSecondsRealtime(1));
        }
        Destroy(minigame);
        StartTime();
        ToggleAbilityControl();
        if (succeeded)
        {
            Destroy(target.gameObject);
            StartCoroutine(blackout.FadeOutBlack());
        }
        else
        {
            foodCollected = 0;
            StartCoroutine(blackout.FadeInBlack());
            SceneManager.LoadSceneAsync(StateSaver.gameState.curArea.name);
        }
    }
Ejemplo n.º 27
0
        public static async Task <ICharacter> GetCharacter(int userId)
        {
            Webservice webservice  = new Webservice(BASE_URL);
            String     methodRoute = "/byUserId/";
            JObject    jObject     = new JObject();

            jObject = await webservice.HttpClientCaller(CHARACTER_URL + methodRoute + userId);

            JToken value        = jObject["Type"];
            string stringObject = JsonConvert.SerializeObject(jObject);

            if (value.ToObject <String>() == "W")
            {
                Warrior warrior = JsonConvert.DeserializeObject <Warrior>(stringObject);
                return(warrior);
            }
            else if (value.ToObject <String>() == "H")
            {
                Hunter hunter = JsonConvert.DeserializeObject <Hunter>(stringObject);
                return(hunter);
            }
            else
            {
                Magus magus = JsonConvert.DeserializeObject <Magus>(stringObject);
                return(magus);
            }
        }
    public TenderRequest addTenderList(Hunter _hunter)
    {
        string        index  = Time.time + "h" + Random.Range(-10000, 10000);
        TenderRequest tender = new TenderRequest(index, _hunter);

        tenderList.Add(index, tender);
        return(tender);
    }
Ejemplo n.º 29
0
 public Form1()
 {
     InitializeComponent();
     chanSubscriber = new Prey(subscriber.Left, subscriber.Top, subscriber.Width);
     chanel         = new Channel <Point>();
     chanel.AddSubscriber(chanSubscriber);
     hunt = new Hunter <Point>(chanel);
 }
Ejemplo n.º 30
0
    public Vector2 GetTransitionPosition(Hunter hunter)
    {
        Vector2 extents  = hunter.GetCollisionExtents();
        Vector2 position = hunter.GlobalPosition;
        Vector2 delta    = (playerHandler.GlobalPosition - hunter.GlobalPosition) * Direction.Abs() + extents * Direction;

        return(position + delta);
    }
Ejemplo n.º 31
0
    public void onCreateCharacter()
    {
        Hunter currentHunter = masterGameLoop.createHunter(givenName,
                                                           givenSanity, givenMeleeAttackCount, givenActionPointCount,
                                                           givenToughness, givenStrength, givenMovement);

        masterGameLoop.moveToParty(currentHunter);
    }
Ejemplo n.º 32
0
 public void Select(Hunter hunter)
 {
     hunter_name_text.text = hunter.GetHunterName();
     
     hunter_view_camera.transform.SetParent(hunter.transform);
     hunter_view_camera.transform.localPosition = new Vector3(0,0.75F,0);
     
 }
Ejemplo n.º 33
0
    public void Init()
    {
        if(user)cha = user.GetComponentInChildren<Hunter>();
        if(user)hea = user.GetComponentInChildren<Health>();
        if(user)wep = user.GetComponentInChildren<WeaponHolder>();

        Camera cam = GetComponentInChildren<Camera>();
        ratio = cam.orthographicSize/cam.pixelHeight;
        camsize = new Vector2(cam.pixelWidth*ratio,cam.pixelHeight*ratio);
        screensize = camsize/ratio;
    }
Ejemplo n.º 34
0
        public Character ReadClass(int archetype, string wrmc)
        {
            int choice;
            Character player;

            MyTTY.Show("The following " + wrmc + " are available to you:\n\n");

            switch (archetype)
            {
                case 1:
                    MyTTY.Show("1) Knight\n");
                    MyTTY.Show("2) Berserker\n");
                    break;

                case 2:
                    MyTTY.Show("1) Hunter\n");
                    MyTTY.Show("2) Assassin\n");
                    break;

                case 3:
                    MyTTY.Show("1) Sorcerer\n");
                    MyTTY.Show("2) Warlock\n");
                    break;

                case 4:
                    MyTTY.Show("1) Priest\n");
                    MyTTY.Show("2) Druid\n");
                    break;
            }

            choice = MyTTY.ReadIntLimit("\nEnter the number of your selection: ", 2);

            switch (archetype)
            {
                case 1:
                    if (choice < 2) player = new Knight(); else player = new Berserker();
                    break;
                case 2:
                    if (choice < 2) player = new Hunter(); else player = new Assassin();
                    break;
                case 3:
                    if (choice < 2) player = new Sorcerer(); else player = new Warlock();
                    break;
                case 4:
                    if (choice < 2) player = new Priest(); else player = new Druid();
                    break;
                default:
                    player = null;
            }

            return player;
        }
Ejemplo n.º 35
0
 public HunterPlayer(Hunter hunter, int health, int numberOfBites, int bitesRequiredToKill)
 {
     Hunter = hunter;
     MaxHealth = health;
     Health = health;
     BiteCount = numberOfBites;
     BitesRequiredToKill = bitesRequiredToKill;
     ItemCount = 0;
     EventCount = 0;
     ItemsKnownToDracula = new List<ItemCard>();
     ItemsPartiallyKnownToDracula = new List<ItemCard>();
     PartiallyKnownItemChances = new List<float>();
     EventsKnownToDracula = new List<EventCard>();
     HasDogsFaceUp = false;
     HuntersInGroup = new List<Hunter>();
     HuntersInGroup.Add(Hunter);
     EncountersInFrontOfPlayer = new List<EncounterTile>();
 }
Ejemplo n.º 36
0
 /// <summary>
 /// Resolves the Hired Scouts Event
 /// </summary>
 /// <param name="game">The GameState</param>
 /// <param name="hunterPlayingEvent">The Hunter playing the Event</param>
 /// <param name="logic">The artificial intelligence component</param>
 private static void PlayHiredScouts(GameState game, Hunter hunterPlayingEvent, DecisionMaker logic)
 {
     Console.WriteLine("Name the first city");
     var firstLocationToReveal = Location.Nowhere;
     while (firstLocationToReveal == Location.Nowhere || (game.Map.TypeOfLocation(firstLocationToReveal) != LocationType.SmallCity && game.Map.TypeOfLocation(firstLocationToReveal) != LocationType.LargeCity))
     {
         firstLocationToReveal = Enumerations.GetLocationFromString(Console.ReadLine());
     }
     var secondLocationToReveal = Location.Nowhere;
     Console.WriteLine("Name the second city");
     secondLocationToReveal = Location.Nowhere;
     while (secondLocationToReveal == Location.Nowhere || (game.Map.TypeOfLocation(secondLocationToReveal) != LocationType.SmallCity && game.Map.TypeOfLocation(secondLocationToReveal) != LocationType.LargeCity))
     {
         secondLocationToReveal = Enumerations.GetLocationFromString(Console.ReadLine());
     }
     if (DraculaIsPlayingSensationalistPressToPreventRevealingLocation(game, firstLocationToReveal, logic))
     {
         Console.WriteLine("Dracula prevented a location from being revealed");
         logic.EliminateTrailsThatDoNotContainLocation(game, firstLocationToReveal);
     }
     else
     {
         var trailIndex = game.Dracula.RevealCardInTrailWithLocation(firstLocationToReveal);
         if (trailIndex > -1)
         {
             Console.WriteLine("{0} revealed", firstLocationToReveal.Name());
             logic.EliminateTrailsThatDoNotContainLocationAtPosition(game, firstLocationToReveal, trailIndex);
             trailIndex = -2;
         }
         else
         {
             trailIndex = game.Dracula.RevealCardInCatacombsWithLocation(firstLocationToReveal);
         }
         if (trailIndex > -1)
         {
             Console.WriteLine("{0} revealed", firstLocationToReveal.Name());
             logic.EliminateTrailsThatDoNotContainLocationAtPosition(game, firstLocationToReveal, trailIndex);
             game.Dracula.RevealEncountersAtPositionInTrail(trailIndex);
             DrawGameState(game);
         }
         else if (trailIndex == -1)
         {
             Console.WriteLine("{0} is not in Dracula's trail or Catacombs", firstLocationToReveal.Name());
             logic.EliminateTrailsThatContainLocation(game, firstLocationToReveal);
         }
     }
     if (DraculaIsPlayingSensationalistPressToPreventRevealingLocation(game, secondLocationToReveal, logic))
     {
         Console.WriteLine("Dracula prevented a location from being revealed");
         logic.EliminateTrailsThatDoNotContainLocation(game, secondLocationToReveal);
     }
     else
     {
         var trailIndex = game.Dracula.RevealCardInTrailWithLocation(secondLocationToReveal);
         if (trailIndex > -1)
         {
             Console.WriteLine("{0} revealed", secondLocationToReveal.Name());
             logic.EliminateTrailsThatDoNotContainLocationAtPosition(game, secondLocationToReveal, trailIndex);
             trailIndex = -2;
         }
         else
         {
             trailIndex = game.Dracula.RevealCardInCatacombsWithLocation(secondLocationToReveal);
         }
         if (trailIndex > -1)
         {
             Console.WriteLine("{0} revealed", secondLocationToReveal.Name());
             logic.EliminateTrailsThatDoNotContainLocationAtPosition(game, secondLocationToReveal, trailIndex);
             game.Dracula.RevealEncountersAtPositionInTrail(trailIndex);
             DrawGameState(game);
         }
         else if (trailIndex == -1)
         {
             Console.WriteLine("{0} is not in Dracula's trail or Catacombs", secondLocationToReveal.Name());
             logic.EliminateTrailsThatContainLocation(game, secondLocationToReveal);
         }
     }
 }
Ejemplo n.º 37
0
 /// <summary>
 /// Resolves the Long Day Event
 /// </summary>
 /// <param name="game">The GameState</param>
 /// <param name="hunterPlayingEvent">The Hunter playing the Event</param>
 private static void PlayLongDay(GameState game, Hunter hunterPlayingEvent)
 {
     if (game.TimeOfDay == TimeOfDay.Dawn)
     {
         Console.WriteLine("You cannot play this card during Dawn. Take the card back.");
         var longDayCard = game.EventDiscard.Find(card => card.Event == Event.LongDay);
         game.Hunters[(int)hunterPlayingEvent].EventsKnownToDracula.Add(longDayCard);
         game.EventDiscard.Remove(longDayCard);
         game.Hunters[(int)hunterPlayingEvent].DrawEventCard();
         return;
     }
     game.RegressTimeTracker();
 }
Ejemplo n.º 38
0
 /// <summary>
 /// Resolves the Blood Transfusion Event
 /// </summary>
 /// <param name="game">The GameState</param>
 /// <param name="hunterPlayingEvent">The Hunter playing the Event</param>
 private static void PlayBloodTransfusion(GameState game, Hunter hunterPlayingEvent)
 {
     Console.WriteLine(
         "Who is receiving the transfusion? { 0}= { 1}, { 2}= { 3}, { 4}= { 5}, { 6}= { 7} (-1 to cancel)",
         (int)Hunter.LordGodalming, Hunter.LordGodalming.Name(), (int)Hunter.DrSeward, Hunter.DrSeward.Name(),
         (int)Hunter.VanHelsing, Hunter.VanHelsing.Name(), (int)Hunter.MinaHarker, Hunter.MinaHarker.Name());
     var answer = 0;
     while (answer == 0)
     {
         if (int.TryParse(Console.ReadLine(), out answer))
         {
             if (answer < 1 || answer > 4)
             {
                 answer = 0;
             }
             if (answer == -1)
             {
                 Console.WriteLine("Cancelled, card is still discarded");
                 return;
             }
         }
     }
     if ((Hunter)answer == hunterPlayingEvent)
     {
         Console.WriteLine(
             "Who is giving the transfusion? { 0}= { 1}, { 2}= { 3}, { 4}= { 5}, { 6}= { 7} (-1 to cancel)",
             (int)Hunter.LordGodalming, Hunter.LordGodalming.Name(), (int)Hunter.DrSeward,
             Hunter.DrSeward.Name(), (int)Hunter.VanHelsing, Hunter.VanHelsing.Name(), (int)Hunter.MinaHarker,
             Hunter.MinaHarker.Name());
         answer = 0;
         while (answer == 0)
         {
             if (int.TryParse(Console.ReadLine(), out answer))
             {
                 if (answer < 1 || answer > 4)
                 {
                     answer = 0;
                 }
             }
         }
         game.Hunters[(int)hunterPlayingEvent].AdjustBites(-1);
         game.Hunters[answer].AdjustHealth(-1);
         CheckForHunterDeath(game);
     }
     else
     {
         game.Hunters[(int)hunterPlayingEvent].AdjustHealth(-1);
         game.Hunters[answer].AdjustBites(-1);
         CheckForHunterDeath(game);
     }
 }
Ejemplo n.º 39
0
 /// <summary>
 /// Resolves the Consecrated Ground Event
 /// </summary>
 /// <param name="game">The GameState</param>
 /// <param name="hunterPlayingEvent">The Hunter playing the Event</param>
 private static void PlayConsecratedGround(GameState game, Hunter hunterPlayingEvent, DecisionMaker logic)
 {
     Console.WriteLine("Where would you like to place the Consecrated Ground marker?");
     var ground = Location.Nowhere;
     while (ground == Location.Nowhere || ground == Location.CastleDracula || ground == Location.Galatz ||
            ground == Location.Klausenburg ||
            (game.Map.TypeOfLocation(ground) != LocationType.SmallCity &&
             game.Map.TypeOfLocation(ground) != LocationType.LargeCity))
     {
         ground = Enumerations.GetLocationFromString(Console.ReadLine());
     }
     game.ConsecratedGroundLocation = ground;
     if (ground == game.Dracula.CurrentLocation)
     {
         var index = game.Dracula.RevealCardInTrailWithLocation(ground);
         logic.EliminateTrailsThatDoNotContainLocationAtPosition(game, ground, index);
         game.Dracula.RevealEncountersAtPositionInTrail(index);
     }
     else
     {
         logic.EliminateTrailsThatContainLocationAtPosition(game, ground, game.Dracula.CurrentLocationPosition);
     }
 }
Ejemplo n.º 40
0
 /// <summary>
 /// Resolves the Good Luck Event played at the start of a Hunter's turn
 /// </summary>
 /// <param name="game">The GameState</param>
 /// <param name="hunterPlayingEvent">The Hunter playing the Event</param>
 private static void PlayGoodLuck(GameState game, Hunter hunterPlayingEvent)
 {
     Console.WriteLine("What would you like to discard? 0= Nothing (cancel), 1= Roadblock, 2= Dracula's Ally");
     var answer = -1;
     while (answer == -1)
     {
         if (int.TryParse(Console.ReadLine(), out answer))
         {
             if (answer < 0 || answer > 2)
             {
                 answer = -1;
             }
         }
         switch (answer)
         {
             case 0:
                 Console.WriteLine("Take the card back");
                 var goodLuckCard = game.EventDiscard.Find(card => card.Event == Event.GoodLuck);
                 game.EventDiscard.Remove(goodLuckCard);
                 game.Hunters[(int)hunterPlayingEvent].EventsKnownToDracula.Add(goodLuckCard);
                 game.Hunters[(int)hunterPlayingEvent].DrawEventCard(); break;
             case 1:
                 game.RoadBlockLocation1 = Location.Nowhere;
                 game.RoadBlockLocation2 = Location.Nowhere;
                 game.RoadBlockConnectionType = ConnectionType.None; break;
             case 2:
                 if (game.DraculaAlly != null)
                 {
                     game.EventDiscard.Add(game.DraculaAlly);
                     game.DraculaAlly = null;
                 }
                 break;
         }
     }
 }
Ejemplo n.º 41
0
 /// <summary>
 /// Resolves the Surprising Return Event
 /// </summary>
 /// <param name="game">The GameState</param>
 /// <param name="hunterPlayingEvent">The Hunter playing the Event</param>
 private static void PlaySurprisingReturn(GameState game, Hunter hunterPlayingEvent)
 {
     if (game.EventDiscard.Count == 0)
     {
         return;
     }
     Console.WriteLine("What is the name of the card you are taking from the Event discard pile?");
     var eventRetrieved = Event.None;
     string line = "";
     while (eventRetrieved == Event.None && line.ToLower() != "nothing")
     {
         eventRetrieved = Enumerations.GetEventFromString(Console.ReadLine());
     }
     if (line.ToLower() == "nothing")
     {
         Console.WriteLine("Event discarded");
         return;
     }
     game.Hunters[(int)hunterPlayingEvent].DrawEventCard();
     var eventCardRetrieved = game.EventDiscard.Find(card => card.Event == eventRetrieved);
     game.Hunters[(int)hunterPlayingEvent].EventsKnownToDracula.Add(eventCardRetrieved);
     game.EventDiscard.Remove(eventCardRetrieved);
 }
Ejemplo n.º 42
0
 /// <summary>
 /// Resolves the Stormy Seas Event
 /// </summary>
 /// <param name="game">The GameState</param>
 /// <param name="hunterPlayingEvent">The Hunter playing the Event</param>
 /// <param name="logic">The artificial intelligence component</param>
 private static void PlayStormySeas(GameState game, Hunter hunterPlayingEvent, DecisionMaker logic)
 {
     Console.WriteLine("Where is {0} playing Stormy Seas?", hunterPlayingEvent.Name());
     var stormySeasLocation = Location.Nowhere;
     while (stormySeasLocation == Location.Nowhere ||
            game.Map.TypeOfLocation(stormySeasLocation) != LocationType.Sea)
     {
         stormySeasLocation = Enumerations.GetLocationFromString(Console.ReadLine());
     }
     game.StormySeasLocation = stormySeasLocation;
     game.StormySeasRounds = 2;
     if (stormySeasLocation == game.Dracula.CurrentLocation)
     {
         Console.WriteLine("Dracula was in {0}", stormySeasLocation.Name());
         int position = game.Dracula.RevealCardInTrailWithLocation(stormySeasLocation);
         logic.EliminateTrailsThatDoNotContainLocationAtPosition(game, stormySeasLocation, position);
         var destination = logic.ChoosePortToGoToAfterStormySeas(game);
         if (destination == Location.Nowhere)
         {
             Console.WriteLine("Dracula cannot make a legal move");
             game.Dracula.TakePunishmentForCheating(game);
             return;
         }
         int doubleBackSlot;
         var cardDroppedOffTrail = game.Dracula.MoveTo(destination, Power.None, out doubleBackSlot);
         logic.AddDisembarkedCardToAllPossibleTrails(game);
         if (doubleBackSlot > -1)
         {
             Console.WriteLine("Dracula Doubled Back to the location in slot {0}", doubleBackSlot + 1);
         }
         var cardsDroppedOffTrail = new List<DraculaCardSlot>();
         if (cardDroppedOffTrail != null)
         {
             cardsDroppedOffTrail.Add(cardDroppedOffTrail);
         }
         if (DraculaIsPlayingSensationalistPressToPreventRevealingLocation(game, destination, logic))
         {
             Console.WriteLine("Dracula prevented a location from being revealed");
         }
         else
         {
             game.Dracula.RevealCardInTrailWithLocation(destination);
             logic.EliminateTrailsThatDoNotContainLocationAtPosition(game, destination, 0);
         }
         DealWithDroppedOffCardSlots(game, cardsDroppedOffTrail, logic);
         CheckForJonathanHarker(game, logic);
     }
     else
     {
         logic.EliminateTrailsThatContainLocation(game, stormySeasLocation);
     }
 }
Ejemplo n.º 43
0
 /// <summary>
 /// Handles the Sense of Emergency card or Resolve ability
 /// </summary>
 /// <param name="game">The GameState</param>
 /// <param name="hunterPlayingEvent">The Hunter playing the Event</param>
 /// <param name="logic">The artificial intelligence component</param>
 private static void PlaySenseOfEmergency(GameState game, Hunter hunterPlayingEvent, DecisionMaker logic)
 {
     if (game.Hunters[(int)hunterPlayingEvent].Health <= 6 - game.Vampires)
     {
         Console.WriteLine("{0} does not have enough health", hunterPlayingEvent.Name());
         return;
     }
     Console.WriteLine("{0} loses {1} health", hunterPlayingEvent.Name(), 6 - game.Vampires);
     game.Hunters[(int)hunterPlayingEvent].AdjustHealth(game.Vampires - 6);
     Console.WriteLine("Where is {0} moving?");
     var destination = Location.Nowhere;
     while (destination == Location.Nowhere)
     {
         destination = Enumerations.GetLocationFromString(Console.ReadLine());
     }
     HandleMoveOperation(game, ((int)hunterPlayingEvent).ToString(), destination.Name(), logic);
 }
Ejemplo n.º 44
0
 /// <summary>
 /// Resolves the Re-Equip Event
 /// </summary>
 /// <param name="game">The GameState</param>
 /// <param name="hunterPlayingEvent">The Hunter playing the Event</param>
 private static void PlayReEquip(GameState game, Hunter hunterPlayingEvent)
 {
     if (DiscardUnknownItemFromHunter(game, game.Hunters[(int)hunterPlayingEvent]))
     {
         game.Hunters[(int)hunterPlayingEvent].DrawItemCard();
         Console.WriteLine("Now draw another card from the Item deck and shuffle it. You now have {0} Items", game.Hunters[(int)hunterPlayingEvent].ItemCount);
     }
     CheckForCardsRevealedForBeingBitten(game);
 }
Ejemplo n.º 45
0
 /// <summary>
 /// Resolves the Newspaper Reports Event or Resolve ability
 /// </summary>
 /// <param name="game">The GameState</param>
 /// <param name="hunterPlayingEvent">The Hunter playing the Event</param>
 /// <param name="logic">The artificial intelligence component</param>
 private static void PlayNewsPaperReports(GameState game, Hunter hunterPlayingEvent, DecisionMaker logic)
 {
     for (var i = 5; i > 0; i--)
     {
         if (game.Dracula.Trail[i] != null &&
             game.Dracula.Trail[i].DraculaCards.First().Location != Location.Nowhere &&
             game.Dracula.Trail[i].DraculaCards.First().Location != game.Dracula.CurrentLocation &&
             !game.Dracula.Trail[i].DraculaCards.First().IsRevealed)
         {
             if (DraculaIsPlayingSensationalistPressToPreventRevealingLocation(game,
                 game.Dracula.Trail[i].DraculaCards.First().Location, logic))
             {
                 Console.WriteLine("Dracula prevented a location from being revealed");
             }
             else
             {
                 game.Dracula.RevealCardAtPosition(i);
                 logic.EliminateTrailsThatDoNotContainLocationAtPosition(game, game.Dracula.Trail[i].DraculaCards.First().Location, i);
                 break;
             }
         }
     }
 }
Ejemplo n.º 46
0
 /// <summary>
 /// Resolves the Mystic Research Event
 /// </summary>
 /// <param name="game">The GameState</param>
 /// <param name="hunterPlayingEvent">The Hunter playing the Event</param>
 private static void PlayMysticResearch(GameState game, Hunter hunterPlayingEvent)
 {
     if (!game.Dracula.EventHand.Any())
     {
         Console.WriteLine("Dracula has no Events to reveal");
         return;
     }
     Console.WriteLine("These are Dracula's Event cards: ");
     foreach (var e in game.Dracula.EventHand)
     {
         Console.Write(" {0},", e.Event.Name());
     }
     Console.WriteLine("");
 }
Ejemplo n.º 47
0
 /// <summary>
 /// Resolves the Money Trail Event
 /// </summary>
 /// <param name="game">The GameState</param>
 /// <param name="hunterPlayingEvent">The Hunter playing the Event</param>
 /// <param name="logic">The artificial intelligence component</param>
 private static void PlayMoneyTrail(GameState game, Hunter hunterPlayingEvent, DecisionMaker logic)
 {
     for (var i = 5; i > 0; i--)
     {
         if (game.Dracula.Trail[i] != null &&
             game.Map.TypeOfLocation(game.Dracula.Trail[i].DraculaCards.First().Location) == LocationType.Sea)
         {
             if (DraculaIsPlayingSensationalistPressToPreventRevealingLocation(game,
                 game.Dracula.Trail[i].DraculaCards.First().Location, logic))
             {
                 Console.WriteLine("Dracula prevented a location from being revealed");
             }
             else
             {
                 game.Dracula.RevealCardAtPosition(i);
                 logic.EliminateTrailsThatDoNotContainLocationAtPosition(game, game.Dracula.Trail[i].DraculaCards.First().Location, i);
             }
         }
     }
 }
Ejemplo n.º 48
0
 public void CreateHunter()
 {
     _classUnderTest = new Hunter();
 }
 private void AddHunterLoss(HSCounter hsc)
 {
     Hunter hunter = new Hunter();
     hunter.LoseButton_Clicked(hsc);
 }
Ejemplo n.º 50
0
 /// <summary>
 /// Resolves the Telegraph Ahead Event
 /// </summary>
 /// <param name="game">The GameState</param>
 /// <param name="hunterPlayingEvent">The Hunter playing the Event</param>
 /// <param name="logic">The artificial intelligence component</param>
 private static void PlayTelegraphAhead(GameState game, Hunter hunterPlayingEvent, DecisionMaker logic)
 {
     foreach (var loc in game.Map.LocationsConnectedByRoadTo(game.Hunters[(int)hunterPlayingEvent].CurrentLocation))
     {
         if (DraculaIsPlayingSensationalistPressToPreventRevealingLocation(game, loc, logic))
         {
             Console.WriteLine("Dracula prevented a location from being revealed");
         }
         else
         {
             int position = game.Dracula.RevealCardInTrailWithLocation(loc);
             if (position > -1)
             {
                 Console.WriteLine("{0} revealed", loc.Name());
                 logic.EliminateTrailsThatDoNotContainLocationAtPosition(game, loc, position);
             }
             else
             {
                 position = game.Dracula.RevealCardInCatacombsWithLocation(loc);
                 if (position > -1)
                 {
                     Console.WriteLine("{0} revealed", loc.Name());
                     logic.EliminateTrailsThatContainLocation(game, loc);
                 }
                 else
                 {
                     logic.EliminateTrailsThatContainLocation(game, loc);
                 }
             }
         }
     }
 }
Ejemplo n.º 51
0
 /// <summary>
 /// Resolves the Excellent Weather Event
 /// </summary>
 /// <param name="game">The GameState</param>
 /// <param name="hunterPlayingEvent">The Hunter playing the Event</param>
 private static void PlayExcellentWeather(GameState game, Hunter hunterPlayingEvent)
 {
     Console.WriteLine("{0} may make up to four sea moves this turng", hunterPlayingEvent.Name());
 }
Ejemplo n.º 52
0
 /// <summary>
 /// Resolves the Vampire Lair Event card
 /// </summary>
 /// <param name="game">The GameState</param>
 /// <param name="hunterPlayingEvent">The Hunter playing the Event</param>
 /// <param name="logic">The artificial intelligence component</param>
 private static void PlayVampireLair(GameState game, Hunter hunterPlayingEvent, DecisionMaker logic)
 {
     if (game.Vampires < 1)
     {
         Console.WriteLine("No Vampires to battle");
         return;
     }
     if (ResolveCombat(game, new List<HunterPlayer> { game.Hunters[(int)hunterPlayingEvent] }, Opponent.NewVampire,
         logic))
     {
         game.AdjustVampires(-1);
     }
 }
Ejemplo n.º 53
0
 /// <summary>
 /// Resolves the Chartered Carriage Event
 /// </summary>
 /// <param name="game">The GameState</param>
 /// <param name="hunterPlayingEvent">The Hunter playing the Event</param>
 /// <param name="logic">The artificial intelligence component</param>
 private static void PlayCharteredCarriage(GameState game, Hunter hunterPlayingEvent, DecisionMaker logic)
 {
     if (DraculaIsPlayingFalseTipoffToCancelCharteredCarriage(game, logic))
     {
         Console.WriteLine("Chartered Carriage cancelled");
         return;
     }
     Console.WriteLine("{0} catches a fast train this turn", hunterPlayingEvent.Name());
 }
Ejemplo n.º 54
0
 /// <summary>
 /// Resolves a Hunter using the Holy Water Item or the Holy Water font at St. Joseph & St. Mary
 /// </summary>
 /// <param name="game">The GameState</param>
 /// <param name="hunterReceivingHolyWater">The Hunter receiving the Holy Water effect</param>
 private static void UseHolyWaterOnHunter(GameState game, Hunter hunterReceivingHolyWater)
 {
     if (hunterReceivingHolyWater == Hunter.MinaHarker)
     {
         Console.WriteLine("Mina's bite cannot be cured");
         return;
     }
     Console.WriteLine("Roll a die and enter the result");
     var dieRoll = 0;
     while (dieRoll == 0)
     {
         if (int.TryParse(Console.ReadLine(), out dieRoll))
         {
             if (dieRoll < 1 || dieRoll > 7)
             {
                 dieRoll = 0;
             }
         }
     }
     switch (dieRoll)
     {
         case 1:
             Console.WriteLine("{0} loses 2 health", hunterReceivingHolyWater.Name());
             game.Hunters[(int)hunterReceivingHolyWater].AdjustHealth(-2);
             CheckForHunterDeath(game); break;
         case 2:
         case 3:
         case 4:
             Console.WriteLine("Nothing happens"); break;
         case 5:
         case 6:
             Console.WriteLine("{0} is cured of a Bite", hunterReceivingHolyWater.Name());
             game.Hunters[(int)hunterReceivingHolyWater].AdjustBites(-1); break;
     }
 }
Ejemplo n.º 55
0
 /// <summary>
 /// Moves the given Hunter to the given Location, along with all Hunters in the given Hunter's group
 /// </summary>
 /// <param name="game">The GameState</param>
 /// <param name="hunterIndex">A string to be converted to the Hunter discarding the card</param>
 /// <param name="location">The name of the Location to move to</param>
 /// <returns>The position of the card in Dracula's trail (0-5) or catacombs (6-8) that corresponds to the given location, or -1 if not in the trail/catacombs</returns>
 private static int MoveHunter(GameState game, string hunterIndex, string location, out Hunter hunterMoved,
     out Location originatingLocation, DecisionMaker logic)
 {
     var hunterToMove = Hunter.Nobody;
     int index;
     if (int.TryParse(hunterIndex, out index))
     {
         hunterToMove = game.GetHunterFromInt(index);
     }
     var line = "";
     while (hunterToMove == Hunter.Nobody && index != -1)
     {
         Console.WriteLine("Who is moving? {0}= {1}, {2}= {3}, {4}= {5}, {6}= {7} (-1 to cancel)",
             (int)Hunter.LordGodalming, Hunter.LordGodalming.Name(), (int)Hunter.DrSeward,
             Hunter.DrSeward.Name(), (int)Hunter.VanHelsing, Hunter.VanHelsing.Name(), (int)Hunter.MinaHarker,
             Hunter.MinaHarker.Name());
         line = Console.ReadLine();
         if (int.TryParse(line, out index))
         {
             if (index == -1)
             {
                 Console.WriteLine("Cancelled");
                 hunterMoved = Hunter.Nobody;
                 originatingLocation = Location.Nowhere;
                 return -1;
             }
             hunterToMove = game.GetHunterFromInt(index);
             Console.WriteLine(hunterToMove.Name());
         }
         else
         {
             Console.WriteLine("I didn't understand that");
         }
     }
     hunterMoved = (Hunter)index;
     originatingLocation = game.Hunters[(int)hunterMoved].CurrentLocation;
     Location destination;
     if (DraculaIsPlayingControlStorms(game, hunterMoved, logic))
     {
         Console.WriteLine("Dracula is controlling the ship's movement");
         destination = logic.ChoosePortToMoveHuntersToWithControlStorms(game, hunterMoved);
     }
     else
     {
         destination = Enumerations.GetLocationFromString(location);
         while (destination == Location.Nowhere && line.ToLower() != "cancel")
         {
             Console.WriteLine("Where is {0} moving? (Type cancel to cancel)", hunterToMove.Name());
             line = Console.ReadLine();
             destination = Enumerations.GetLocationFromString(line);
             Console.WriteLine(destination.Name());
         }
         if (line.ToLower() == "cancel")
         {
             Console.WriteLine("Cancelled");
             return -1;
         }
     }
     Console.Write("{0} moved from {1} to ", hunterToMove.Name(),
         game.Hunters[(int)hunterToMove].CurrentLocation.Name());
     foreach (var h in game.Hunters[(int)hunterToMove].HuntersInGroup)
     {
         game.Hunters[(int)h].MoveTo(destination);
     }
     Console.WriteLine(destination.Name() +
                       (game.Hunters[(int)hunterToMove].HuntersInGroup.Count() > 1 ? " with his group" : ""));
     for (var i = 0; i < 6; i++)
     {
         if (game.Dracula.Trail[i] != null && game.Dracula.Trail[i].DraculaCards.First().Location == destination)
         {
             return i;
         }
     }
     for (var i = 0; i < 3; i++)
     {
         if (game.Dracula.Catacombs[i] != null &&
             game.Dracula.Catacombs[i].DraculaCards.First().Location == destination)
         {
             return i + 6;
         }
     }
     return -1;
 }
Ejemplo n.º 56
0
 /// <summary>
 /// Determines if Dracula is playing Control Storms at the start of a Hunter's movement
 /// </summary>
 /// <param name="game">The GameState</param>
 /// <param name="hunterMoved">The Hunter moving</param>
 /// <param name="logic">The artificial intelligence component</param>
 /// <returns>True if Dracula successfully played Control Storms</returns>
 private static bool DraculaIsPlayingControlStorms(GameState game, Hunter hunterMoved, DecisionMaker logic)
 {
     if (logic.ChooseToPlayControlStorms(game, hunterMoved))
     {
         Console.WriteLine("Dracula is playing Control Storms to control your movement");
         game.Dracula.DiscardEvent(Event.ControlStorms, game.EventDiscard);
         if (HunterPlayingGoodLuckToCancelDraculaEvent(game, Event.ControlStorms, Event.ControlStorms, logic) >
             0)
         {
             Console.WriteLine("Control Storms cancelled");
             return false;
         }
         return true;
     }
     return false;
 }
Ejemplo n.º 57
0
 /// <summary>
 /// Determines if Dracula is playing Customs Search on a Hunter
 /// </summary>
 /// <param name="game">The GameState</param>
 /// <param name="hunterMoved">The Hunter who moved</param>
 /// <param name="origin">The original Location</param>
 /// <param name="logic">The artificial intelligence component</param>
 /// <returns>True if Dracula successfully plays Customs Search</returns>
 private static bool DraculaIsPlayingCustomsSearch(GameState game, Hunter hunterMoved, Location origin,
     DecisionMaker logic)
 {
     if (logic.ChooseToPlayCustomsSearch(game, hunterMoved, origin))
     {
         Console.WriteLine("Dracula is playing Customs Search");
         game.Dracula.DiscardEvent(Event.CustomsSearch, game.EventDiscard);
         if (HunterPlayingGoodLuckToCancelDraculaEvent(game, Event.CustomsSearch, Event.CustomsSearch, logic) > 0)
         {
             Console.WriteLine("Customs Search cancelled");
             return false;
         }
         return true;
     }
     return false;
 }
Ejemplo n.º 58
0
 /// <summary>
 /// Resolves the Hypnosis Event
 /// </summary>
 /// <param name="game">The GameState</param>
 /// <param name="hunterPlayingEvent">The Hunter playing the Event</param>
 /// <param name="logic">The artificial intelligence component</param>
 private static void PlayHypnosis(GameState game, Hunter hunterPlayingEvent, DecisionMaker logic)
 {
     Console.WriteLine("Roll a die and enter the result");
     var dieRoll = 0;
     while (dieRoll == 0)
     {
         if (int.TryParse(Console.ReadLine(), out dieRoll))
         {
             if (dieRoll < 1 || dieRoll > 7)
             {
                 dieRoll = 0;
             }
         }
     }
     switch (dieRoll)
     {
         case 1:
         case 2:
             Console.WriteLine("No effect"); break;
         case 3:
         case 4:
         case 5:
         case 6:
             if (DraculaIsPlayingSensationalistPressToPreventRevealingLocation(game, game.Dracula.CurrentLocation, logic))
             {
                 Console.WriteLine("Dracula prevented a location from being revealed");
             }
             else
             {
                 game.Dracula.RevealCardInTrailWithLocation(game.Dracula.CurrentLocation);
                 logic.EliminateTrailsThatDoNotContainLocationAtPosition(game, game.Dracula.CurrentLocation, game.Dracula.CurrentLocationPosition);
             }
             game.Dracula.RevealAllVampires();
             var power = Power.None;
             var advanceMoveLocation = logic.ChooseDestinationAndPower(game, out power);
             if (advanceMoveLocation == Location.Nowhere && power == Power.None)
             {
                 Console.WriteLine("Dracula will have no legal moves next turn");
             }
             else
             {
                 game.Dracula.AdvanceMoveLocation = advanceMoveLocation;
                 game.Dracula.AdvanceMovePower = power;
                 Console.WriteLine("Dracula's next move will be to {0}{1}", game.Dracula.AdvanceMoveLocation,
                     power == Power.None ? "" : " using " + game.Dracula.AdvanceMovePower.Name());
             }
             break;
     }
 }
Ejemplo n.º 59
0
 /// <summary>
 /// Resolves the situation when a Hunter plays an Ally
 /// </summary>
 /// <param name="game">The GameState</param>
 /// <param name="hunterPlayingEvent">The Hunter playing the Ally Event</param>
 /// <param name="allyBeingPlayed">The Ally Event being played</param>
 private static void PlayHunterAlly(GameState game, Hunter hunterPlayingEvent, Event allyBeingPlayed, DecisionMaker logic)
 {
     if (game.HunterAlly != null)
     {
         game.EventDiscard.Add(game.HunterAlly);
     }
     game.HunterAlly = game.EventDiscard.Find(card => card.Event == allyBeingPlayed);
     game.EventDiscard.Remove(game.HunterAlly);
     if (game.HunterAlly.Event == Event.JonathanHarker)
     {
         CheckForJonathanHarker(game, logic);
     }
 }
Ejemplo n.º 60
0
 /// <summary>
 /// Spends a point of Resolve using the Inner Strength ability
 /// </summary>
 /// <param name="game">The GameState</param>
 /// <param name="hunterSpendingResolve">The Hunter spending the resolve and being healed</param>
 private static void PlayInnerStrength(GameState game, Hunter hunterSpendingResolve)
 {
     game.Hunters[(int)hunterSpendingResolve].AdjustHealth(4);
     Console.WriteLine("{0} now has {1} health", hunterSpendingResolve.Name(), game.Hunters[(int)hunterSpendingResolve].Health);
 }