Exemplo n.º 1
0
        public void MonsterHealthShouldNotBeGreaterThan50()
        {
            CreatureModel testCreature = new CreatureModel("Antman", 1, 4, 5, 4, 5, "");
            MonsterModel  testMonster  = new MonsterModel(testCreature, 40, "Beast");

            testMonster.Health = 52;
            Assert.IsFalse(testMonster.Health <= 50, "Monster health should not be greater than 50");
        }
Exemplo n.º 2
0
        public void MonsterDexterityShouldNotBeGreaterThan50()
        {
            CreatureModel testCreature = new CreatureModel("Antman", 1, 4, 5, 4, 5, "");
            MonsterModel  testMonster  = new MonsterModel(testCreature, 40, "Beast");

            testMonster.Dexterity = 52;
            Assert.IsFalse(testMonster.Dexterity <= 50, "Monster dexterity should not be greater than 50");
        }
Exemplo n.º 3
0
        public void MonsterHealthShouldNotBeLessThan0()
        {
            CreatureModel testCreature = new CreatureModel("Antman", 1, 4, 5, 4, 5, "");
            MonsterModel  testMonster  = new MonsterModel(testCreature, 40, "Beast");

            testMonster.Health = -1;
            Assert.IsFalse(testMonster.Health >= 0, "Monster health must not be less than 1 ");
        }
Exemplo n.º 4
0
        public void MonsterDexterityShouldBeLessThan50()
        {
            CreatureModel testCreature = new CreatureModel("Antman", 1, 4, 5, 4, 5, "");
            MonsterModel  testMonster  = new MonsterModel(testCreature, 40, "Beast");

            testMonster.Dexterity = 48;
            Assert.IsTrue(testMonster.Dexterity < 50, "Monster dexterity must be max 50");
        }
Exemplo n.º 5
0
        public void MonsterHealthShouldBeLessThan50()
        {
            CreatureModel testCreature = new CreatureModel("Antman", 1, 4, 5, 4, 5, "");
            MonsterModel  testMonster  = new MonsterModel(testCreature, 40, "Beast");

            testMonster.Health = 48;
            Assert.IsTrue(testMonster.Health < 50, "Monster health must be max 50");
        }
Exemplo n.º 6
0
        public void MonsterHealthMustBeGreaterThanZero()
        {
            CreatureModel monsterTestCreature = new CreatureModel("Antman", 1, 4, 5, 4, 5, "");
            MonsterModel  testMonster         = new MonsterModel(monsterTestCreature, 40, "Beast");

            testMonster.Health = 10;
            Assert.IsTrue(testMonster.Health >= 0, "Monster health must be greater or equal to zero ");
        }
Exemplo n.º 7
0
        public void MonsterSpeedIsEqualTo4()
        {
            CreatureModel monsterTestCreature = new CreatureModel("Antman", 1, 4, 5, 4, 5, "");
            MonsterModel  testMonster         = new MonsterModel(monsterTestCreature, 40, "Beast");

            testMonster.Speed = 4;
            Assert.IsTrue(testMonster.Speed == 4, "Monster speed must equal to 4");
        }
Exemplo n.º 8
0
        public void MonsterSpeedShouldNotBeLessThan1()
        {
            CreatureModel testCreature = new CreatureModel("Antman", 1, 4, 5, 4, 5, "");
            MonsterModel  testMonster  = new MonsterModel(testCreature, 40, "Beast");

            testMonster.Speed = 0;
            Assert.IsFalse(testMonster.Speed >= 1, "Monster speed must not be less than 1 ");
        }
Exemplo n.º 9
0
        public void MonsterSpeedShouldBeLessThan50()
        {
            CreatureModel testCreature = new CreatureModel("Antman", 1, 4, 5, 4, 5, "");
            MonsterModel  testMonster  = new MonsterModel(testCreature, 40, "Beast");

            testMonster.Speed = 48;
            Assert.IsTrue(testMonster.Speed < 50, "Monster speed must be max 50");
        }
Exemplo n.º 10
0
        public void MonsterSpeedShouldNotBeGreaterThan50()
        {
            CreatureModel testCreature = new CreatureModel("Antman", 1, 4, 5, 4, 5, "");
            MonsterModel  testMonster  = new MonsterModel(testCreature, 40, "Beast");

            testMonster.Speed = 52;
            Assert.IsFalse(testMonster.Speed <= 50, "Monster speed should not be greater than 50");
        }
Exemplo n.º 11
0
 public Creature(string _name, Vector3Int _pos, creatureType _type = creatureType.neutral, CreatureModel _model = CreatureModel.human, CreatureSex _sex = CreatureSex.none, creatureSize _size = creatureSize.medium)
 {
     name  = _name;
     type  = _type;
     model = _model;
     sex   = _sex;
     size  = _size;
     worldSpacePosition = _pos;
 }
Exemplo n.º 12
0
        public ActionResult AddtoInit(int id)
        {
            CreatureModel model = CreatureIO.Select(id);

            InitiativeIO.AddRecord(model);


            return(RedirectToAction("Index", "Initiative"));
        }
Exemplo n.º 13
0
 public CompanyModel(string _name, GovernmentModel[] govs, CreatureModel _ceo)
 {
     name      = _name;
     ceo.Model = _ceo;
     foreach (GovernmentModel gov in govs)
     {
         governmentAccess.Add(gov);
     }
 }
Exemplo n.º 14
0
        public ActionResult Create(CreatureModel model)
        {
            if (ModelState.IsValid)
            {
                CreatureIO.AddRecord(model);
            }


            return(RedirectToAction("Index", "Initiative"));
        }
Exemplo n.º 15
0
        public void MonsterIsDeadWhenHealthIs0()
        {
            CreatureModel testCreature = new CreatureModel("Antman", 1, 4, 5, 4, 5, "");
            MonsterModel  testMonster  = new MonsterModel(testCreature, 40, "Beast");

            testMonster.Health = 0;
            MonsterController testMonsterController = new MonsterController();

            Assert.IsTrue(testMonsterController.isDead(testMonster), "Monster is dead");
        }
Exemplo n.º 16
0
        public void MonsterIsAliveWhenHealthIsGreaterThan0()
        {
            CreatureModel testCreature = new CreatureModel("Antman", 1, 4, 5, 4, 5, "");
            MonsterModel  testMonster  = new MonsterModel(testCreature, 40, "Beast");

            testMonster.Health = 10;
            MonsterController testMonsterController = new MonsterController();

            Assert.IsFalse(testMonsterController.isDead(testMonster), "Monster is alive");
        }
Exemplo n.º 17
0
    public void Init(CreatureModel nullthing)
    {
        this.movableObject = nullthing.GetMovableNode();
        //Bad.GetComponent<AnimatorEventScript>().SetTarget(nullthing.script as IAnimatorEventCalled);
        //Normal.GetComponent<AnimatorEventScript>().SetTarget(nullthing.script as IAnimatorEventCalled);
        Egg.GetComponent <AnimatorEventScript>().SetTarget(nullthing.script as IAnimatorEventCalled);

        level2Script.SetTarget(animScript);
        current = malkutAgent;
        level1SpriteRenderer.SetSprite(current);
    }
Exemplo n.º 18
0
 public CreatureInputModel(CreatureModel model)
 {
     CreatureType    = model.CreatureType;
     Id              = model.Id;
     Name            = model.Name;
     HP              = model.HP;
     AC              = model.AC;
     MaxHP           = model.HP;
     InitiativeBonus = model.InitiativeBonus;
     ImagePath       = model.ImagePath;
 }
Exemplo n.º 19
0
        public void MonsterDoesNotGiveAwayRewards()
        {
            CreatureModel testCreature = new CreatureModel("Antman", 1, 4, 5, 4, 5, "");
            MonsterModel  testMonster  = new MonsterModel(testCreature, 40, "Beast");

            testMonster.Reward = 10;
            testMonster.Health = 20;
            MonsterController testMonsterController = new MonsterController();

            Assert.IsTrue(testMonsterController.giveReward(testMonster) == 0, "Monster still has rewards 10 because it has health 20");
        }
Exemplo n.º 20
0
        public void MonsterGivesAwayRewards()
        {
            CreatureModel testCreature = new CreatureModel("Antman", 1, 4, 5, 4, 5, "");
            MonsterModel  testMonster  = new MonsterModel(testCreature, 40, "Beast");

            testMonster.Reward = 10;
            testMonster.Health = 0;
            MonsterController testMonsterController = new MonsterController();

            Assert.IsTrue(testMonsterController.giveReward(testMonster) == 10, "Monster is dead therefore the rewards should give Character 10 points");
        }
Exemplo n.º 21
0
    // Update is called once per frame
    void Update()
    {
        if (Input.GetMouseButtonDown(0))
        {
            Vector3      rayPos = Camera.main.ScreenToWorldPoint(Input.mousePosition);
            RaycastHit2D hit    = Physics2D.CircleCast(rayPos, .1f, Vector2.up, .1f);

            if (hit.collider != null)
            {
                Debug.Log(hit.transform.gameObject.name);
                //nVisual.selectedNeuralObject = hit.transform.GetComponent<Creature>();
            }
            else
            {
                //nVisual.selectedNeuralObject = null;
            }
        }

        if (Input.GetKeyDown(KeyCode.Comma))
        {
            Time.timeScale *= .5f;
        }
        if (Input.GetKeyDown(KeyCode.Period))
        {
            Time.timeScale *= 2;
        }

        infoText.text = "Population: " + population
                        + "\nTime: " + Time.time.ToString("0")
                        + "\nTime Scale: " + Time.timeScale;


        //Check pop
        if (population < minPop)
        {
            CreatureModel model = new CreatureModel();

            model.numInputs           = numInputs;
            model.numOutputs          = numOutputs;
            model.numHiddenLayers     = numHiddenLayers;
            model.numNodeHiddenLayers = numNodeHiddenLayers;

            model = Creature.CreateCreature(model);

            Creature creature = Controller.Instantiate <Creature>("creature", model, parent.transform);

            creature.transform.position = new Vector3(Random.Range(0, land.x), Random.Range(0, land.y));

            population++;
        }
    }
Exemplo n.º 22
0
 public override void Init(object target)
 {
     if (!(target is CreatureModel))
     {
         Debug.Log("Error");
         return;
     }
     base.Init(target);
     this.model       = target as CreatureModel;
     this.Name.text   = model.metaInfo.name;
     this.Fear.text   = model.metaInfo.level;
     this.Phyisc.text = model.metaInfo.physicalAttackLevel.ToString();
     this.Mental.text = model.metaInfo.mentalAttackLevel.ToString();
 }
Exemplo n.º 23
0
    public static SuppressWindow CreateWindow(CreatureModel target)
    {
        if (currentWindow.gameObject.activeSelf)
        {
            if (currentWindow.target == target)
            {
                return(currentWindow);
            }
        }
        else
        {
            currentWindow.gameObject.SetActive(true);
            currentWindow.line.gameObject.SetActive(true);
            currentWindow.Activate();
        }

        SuppressWindow inst = currentWindow;

        inst.target     = target;
        inst.targetType = TargetType.CREATURE;

        if (inst.currentSefira != target.sefira)
        {
            inst.currentSefira = target.sefira;
            inst.agentList.Clear();
            inst.SetSprites(target.sefira);
        }
        inst.InitAgentList();
        inst.ShowAgentList();

        CreatureUnit unit = CreatureLayer.currentLayer.GetCreature(target.instanceId);

        inst.attachedPos = unit.transform;
        inst.ui.Init(target, inst.targetType);

        if (inst.activatableObjectInitiated == false)
        {
            inst.UIActivateInit();
        }

        Canvas canvas = inst.transform.GetChild(0).GetComponent <Canvas>();

        canvas.worldCamera = UIActivateManager.instance.GetCam();

        currentWindow = inst;

        return(inst);
    }
Exemplo n.º 24
0
        public static uint SelectPetDisplay(BattlePetSpeciesRecord speciesEntry)
        {
            CreatureTemplate creatureTemplate = Global.ObjectMgr.GetCreatureTemplate(speciesEntry.CreatureID);

            if (creatureTemplate != null)
            {
                if (!speciesEntry.GetFlags().HasFlag(BattlePetSpeciesFlags.RandomDisplay))
                {
                    CreatureModel creatureModel = creatureTemplate.GetRandomValidModel();
                    if (creatureModel != null)
                    {
                        return(creatureModel.CreatureDisplayID);
                    }
                }
            }

            return(0);
        }
Exemplo n.º 25
0
    public void Insert(CreatureModel creatureModel)
    {
        OpenConnection();

        var preparedStatement = new SqliteCommand
        {
            CommandText = Query.INSERT_INTO_MONSTERS,
            Connection  = (SqliteConnection)connection
        };

        preparedStatement.Parameters.Add(CreateParameter("class", creatureModel.CreatureClass));
        preparedStatement.Parameters.Add(CreateParameter("family", creatureModel.Family));
        preparedStatement.Parameters.Add(CreateParameter("creature", creatureModel.CreatureName));
        preparedStatement.Parameters.Add(CreateParameter("trait", creatureModel.TraitName));
        preparedStatement.Parameters.Add(CreateParameter("description", creatureModel.TraitDescription));
        preparedStatement.Parameters.Add(CreateParameter("material", creatureModel.MaterialName));
        preparedStatement.ExecuteNonQuery();

        preparedStatement.Dispose();
        Close();
    }
Exemplo n.º 26
0
        public ActionResult Move(int id)
        {
            BattleMapModel battlemapRecord = BattleMapIO.GetData();

            int x = id % battlemapRecord.Width;
            int y = id / battlemapRecord.Width;


            CreatureModel creature = InitiativeIO.GetInitiative().Find(item => item.Id == battlemapRecord.MovingId);

            if (creature != null)
            {
                creature.PositionX = x;
                creature.PositionY = y;
                InitiativeIO.UpdateRecord(creature);
            }
            battlemapRecord.MovingId = 0;
            BattleMapIO.UpdateRecord(battlemapRecord);


            return(RedirectToAction("Index"));
        }
Exemplo n.º 27
0
        /// <summary>
        /// Aktualizacja podanego rekordu w bazie danych. Wyszukuje rekord i zamienia wartości wybranych pól.
        /// </summary>
        /// <param name="newModel"></param>
        public static void UpdateRecord(CreatureModel newModel)
        {
            string fullPath = FileIO.GetProgDataPath(initiativePath);

            //deserializacja aktualnej bazy danych
            List <InitiativeInputModel> rawData = JsonConvert.DeserializeObject <List <InitiativeInputModel> >(FileIO.ReadTxt(fullPath));

            //losowanie inicjatywy dla nowego rekordu, jeżeli nie jeszcze jej nie ma
            if (newModel.Initiative == 0)
            {
                Random randomiser = new Random();
                newModel.Initiative = randomiser.Next(1, 20) + newModel.InitiativeBonus;
            }

            //znajdowanie pozycji potrzebnego rekordu w LIŚCIE pobranej z bazy danych (to nie jest Id w bazie danych)
            int id = rawData.FindIndex(item => item.Id == newModel.Id);

            if (id == -1)
            {
                throw new Exception("Nie można zaktualizować rekordu: rekord nie istnieje.");
            }

            //aktualizacja wybranych pól
            rawData[id].Initiative = newModel.Initiative;
            rawData[id].HP         = newModel.HP;
            if (newModel.PositionX != -1)
            {
                rawData[id].PositionX = newModel.PositionX;
            }
            if (newModel.PositionY != -1)
            {
                rawData[id].PositionY = newModel.PositionY;
            }

            //powrotna serializacja i zapis
            string output = JsonConvert.SerializeObject(rawData);

            FileIO.WriteText(fullPath, output);
        }
Exemplo n.º 28
0
    // Use this for initialization
    void Start()
    {
        population = startingPop;
        parent     = new GameObject("Population");
        for (int i = 0; i < startingPop; i++)
        {
            CreatureModel model = new CreatureModel();

            model.numInputs           = numInputs;
            model.numOutputs          = numOutputs;
            model.numHiddenLayers     = numHiddenLayers;
            model.numNodeHiddenLayers = numNodeHiddenLayers;

            model = Creature.CreateCreature(model);

            Creature creature = Controller.Instantiate <Creature>("creature", model, parent.transform);

            creature.transform.position = new Vector3(Random.Range(0, land.x), Random.Range(0, land.y));
        }

        Message.AddListener("Creature Death", OnDeath);
        Message.AddListener("Creature Birth", OnBirth);
    }
Exemplo n.º 29
0
    public static StationModel CreateStation(string name, SolarModel star, int parentIndex, Orbit orbit, IdentityModel owner, CreatureModel captain)
    {
        StationModel model = new StationModel();

        model.owner   = new ModelRef <IdentityModel>(owner);
        model.manager = new ModelRef <CreatureModel>(captain);
        model.manager.Model.location.Model = model;

        model.workers        = 10;
        model.workerCapacity = 50;

        model.name        = name;
        model.dateCreated = new Dated(GameManager.instance.data.date.time);
        model.lastUpdated = new Dated(GameManager.instance.data.date.time);
        model.capacity    = 10000;
        System.Random rand = new System.Random(model.name.GetHashCode());
        float         a    = rand.Next(1000) / 1000f;
        float         b    = rand.Next(1000) / 1000f;
        float         c    = rand.Next(1000) / 1000f;

        model.color           = new Color(a, b, c);
        a                     = rand.Next(1000) / 1000f;
        b                     = rand.Next(1000) / 1000f;
        c                     = rand.Next(1000) / 1000f;
        model.backgroundColor = new Color(a, b, c);
        model.parentIndex     = parentIndex;
        model.orbit           = orbit;
        star.stations.Add(model);
        //if (position.radius == 0 && parent.rawResource != RawResources.None)
        //{
        //    model.factory = new Factory(parent.rawResource,model);
        //}
        //else
        //{
        //    model.factory = new Factory(true, model);
        //}


        foreach (Items item in model.factory.inputItems)
        {
            item.pendingAmount = item.amount;
        }
        foreach (Items item in model.factory.outputItems)
        {
            item.pendingAmount = item.amount;
        }

        //Money Setup
        model.money              = 1000000f;
        model.owner.Model.money -= 1000000;
        model.moneyStats         = new DataGraph("Money Over Time", "Time (hours)", "Money");
        model.moneyStats.data.Add("Money", new List <Stat>()
        {
            new Stat(model.age.hour, model.money)
        });
        model.moneyStats.data.Add("Money Change", new List <Stat>());

        return(model);
    }
Exemplo n.º 30
0
 public void UpdateStateIdle()
 {
     state       = AgentCmdState.IDLE;
     this.target = null;
     Notice.instance.Send(NoticeName.MakeName(NoticeName.ChangeAgentState, instanceId.ToString()));
 }