Inheritance: MonoBehaviour
示例#1
0
    private float startx = -2.0f; //몬스터들 의위 치값 을관리하 는변

    #endregion Fields

    #region Methods

    IEnumerator Factory()
    {
        //대 기시간 을랜덤함수 로이용하 여제작
        float time = Random.Range(3.0f, 5.0f);
        // 3.0 초만큼 대기하라. 3 초 대기 후 아래 루틴 실행
        yield return new WaitForSeconds(time);

        int random = Random.Range(0, 5);
        Monster[] otherMonster = new Monster[4];
        int monsterCount = 0;
        Monster fireMonster = null;
        for(int i=0; i< count; ++i)
        {
            if(i == random){
                GameObject obj = Instantiate(fireEnemy) as GameObject;
                obj.transform.position = new Vector2(startx, 3.5f);
                fireMonster = obj.GetComponent<Monster>();

            }
            else{
                GameObject obj = Instantiate(enemy) as GameObject;
                obj.transform.position = new Vector2(startx, 3.5f);

                otherMonster[monsterCount] = obj.GetComponent<Monster>();
                monsterCount++;
            }
            startx += 1;
        }

        fireMonster.SetMonster(otherMonster);
        startx = -2.0f;

        StartCoroutine(Factory());
    }
示例#2
0
 /// <summary>
 /// Check that hero attack is first
 /// </summary>
 /// <param name="parMonster">Monster</param>
 /// <returns>First attack</returns>
 public override bool CheckFirstStrike(Monster parMonster)
 {
     FirstStrike = true;
     bool first = base.CheckFirstStrike(parMonster);
     FirstStrike = true;
     return first;
 }
 void Awake()
 {
     alertArea = GetComponent<SphereCollider>();
     monster = GetComponent<Monster>();
     player = GameObject.FindGameObjectWithTag(Tags.player);
     layers = GameObject.FindGameObjectWithTag(Tags.gameController).GetComponent<Layers>();
 }
示例#4
0
 public static void deerAI(Monster monster, Quinoa quinoa)
 {
     if (monster.readyForCommand())
     {
         MonsterActionManager.setMoveCommand(monster, EnumUtil.RandomEnumValue<Direction>());
     }
 }
    private float idleSwitchDelay; // A random time to play RandomIdle animation

    void Start () {
        monster = GetComponent<Monster>();
        
        animation = monster.monsterGameObject.GetComponent<Animation>();

        // Initialize monster animator
        if(animationClips.idle != null)
            animation.AddClip(animationClips.idle, "Idle");

        if(animationClips.randomIdle != null) {
            animation.AddClip(animationClips.randomIdle, "RandomIdle");

            idleSwitchDelay = (Length("Idle") * UnityEngine.Random.Range(4, 8)) + Time.time;
        }

        if(animationClips.moveForward != null)
            animation.AddClip(animationClips.moveForward, "MoveForward");
        if(animationClips.moveBackward != null)
            animation.AddClip(animationClips.moveBackward, "MoveBackward");
        if(animationClips.physicalAttack != null)
            animation.AddClip(animationClips.physicalAttack, "PhysicalAttack");
        if(animationClips.specialAttack != null)
            animation.AddClip(animationClips.specialAttack, "SpecialAttack");
        if(animationClips.takeDamage != null)
            animation.AddClip(animationClips.takeDamage, "TakeDamage");
        if(animationClips.dead != null)
            animation.AddClip(animationClips.dead, "Dead");

        Play("Idle");
    }
示例#6
0
 // Use this for initialization
 void Start()
 {
     S = this;
     spRend = GetComponent<SpriteRenderer> ();
     scream.playOnAwake = false;
     awake = false;
 }
示例#7
0
	void Start () {
		monster = GameData.activeMonster;
		species.text = monster.species;
		if (monster.hatched) {
			eggModel.gameObject.SetActive(false);
			monsterName.text = monster.name;
			birthday.text = "" + monster.birthday.ToString("MMMM dd, yyyy") +
							"\nat " + monster.birthday.ToString("h:mm tt");
			int days = (DateTime.Now - monster.birthday).Days;
			age.text = "" + days + " days old";
			currentLevel.text = "" + monster.level;
			nextLevel.text = "" + (monster.level+1);
			float xpScale = (float)monster.xp / (float)monster.xpToNextLevel;
			Vector3 ls = xpBar.localScale;
			ls.x = xpScale;
			xpBar.localScale = ls;
			float care = (float)monster.care;
			int whichCare = (int)(Math.Ceiling(care/2) - 1);
			for(int i = 0; i <= whichCare; i++){
				if(i == whichCare && care % 2 == 1){
					hearts[i].sprite = halfHeart;
				}else{
					hearts[i].sprite = fullHeart;
				}
			}
		} else {
			monsterModel.gameObject.SetActive(false);
			birthday.text = "Not hatched!";
			age.text = "???";
			currentLevel.text = "?";
			nextLevel.text = "?";
		}
	}
示例#8
0
		/// <summary>
		/// Constructor
		/// </summary>
		/// <param name="monster">Monster handle</param>
		/// <param name="range">Range of the target</param>
		/// <param name="direction">Direction of the target</param>
		public MoveState(Monster monster, int range, CardinalPoint direction) : base(monster)
		{
			TargetRange = range;
			TargetDirection = direction;
			TargetLocation = new DungeonLocation(Monster.Location);
			TargetLocation.Offset(direction, range);
		}
示例#9
0
    public static Character NewOrc( Vector3 location )
    {
        Monster orc = new Monster();
        orc.Name = "Orc";

        if (UnityEngine.Random.value > 0.5)
            orc.MaleLayers.Add("TempSprites/Materials/ork");
        else
            orc.MaleLayers.Add("TempSprites/Materials/orc2");

        orc.FemaleLayers = orc.MaleLayers;
        SetStats(orc, 3, 1, 2,25);

        orc.AddSkill(SkillFactory.FindSkillByName("Swords"), 1);
        orc.AddSkill(SkillFactory.FindSkillByName("Tough"), 2);
        orc.AddSkill(SkillFactory.FindSkillByName("Cleave"), 2);

        orc.InventoryItems.GoldCoins = (int)UnityEngine.Random.Range(10,20);

        orc.EquipItem(ItemFactory.FindItemByName("Sword") as Equipment, Equipment.EquipmentLocation.Weapon);
        orc.EquipItem(ItemFactory.FindItemByName("Leather Armor") as Equipment, Equipment.EquipmentLocation.Torso);
        orc.BackpackItem(ItemFactory.FindItemByName("Watermelon"));

        orc.Smarts = new FightOrFlight();

        return AttachToGame(orc, location,1.45f);
    }
示例#10
0
 /// <summary>
 /// 伤害核心计算公式
 /// </summary>
 /// <param name="monster">怪物</param>
 /// <param name="skillDamage">已经过法强加成的伤害类</param>
 /// <returns>计算抗性后的伤害值</returns>
 public static float CalculateDamage(Monster monster, Damage.SkillDamage skillDamage)
 {
     ///当前版本不存在神圣伤害or物理伤害
     if (!monster.armorComponent)
     {
         return skillDamage.GetTotalDamage();
     }
     float[] elementDefenceList = monster.armorComponent.GetElementDefenceList();
     float sum = 0;
     for (int i = 0; i < Elements.ELEMENT_NUMBER; i++)
     {
         ///当前版本不存在将伤害小于0的效果
         if (skillDamage.elementsDamage[i] < 0)
         {
             skillDamage.elementsDamage[i] = 0;
         }
         ///当前版本不存在将伤害转化成治疗的效果
         float p = 1 - elementDefenceList[i] / 100;
         if (p < 0)
         {
             p = 0;
         }
         sum += skillDamage.elementsDamage[i] * p;
     }
     ///FIXME 物理组件存在物理抗性,物理抗性还需计算
     return sum + skillDamage.physicalDamage;
 }
        public float getCost(Monster mover, int x, int y, int tx, int ty)
        {
            float dx = tx - x;
            float dy = ty - y;

            return ((dx * dx) + (dy * dy));
        }
示例#12
0
        private Monster AssignMonsterStats(Monster monster, CombatContext combatContext)
        {
            monster.BaseStats = _statsGenerator.GenerateStats(monster.Class);

            monster.SetActionSelector(_actionSelector);
            monster.SetCombatContext(combatContext);

            monster.CurrentHitPoints = monster.MaxHitPoints;
            monster.CurrentEnergy = monster.MaxEnergy;

            var bossMultiplier = monster.IsBoss ? 4 : 1;

            monster.Gold = monster.Level * _dice.Roll(3 * bossMultiplier, 6);
            monster.Experience = (monster.Level * _dice.Roll(2 * bossMultiplier, 6));

            if (monster.IsBoss)
            {
                monster.Weapon = weaponFactory.CreateWeapon(monster.Level + 1, true);
            }
            else
            {
                if (_dice.Random(1, 6) == 1)
                {  // 1/6 monsters will have a weapon
                    monster.Weapon = weaponFactory.CreateWeapon(monster.Level, false);
                }
            }

            monster = Itemize(monster);

            return monster;
        }
示例#13
0
 protected int GetPathToPlayerLength(IGameEngineCore engine, Monster monster)
 {
     List<Point> pathToPlayer = GetPathToPlayer(engine, monster);
     if (pathToPlayer == null)
         return -1;
     return pathToPlayer.Count;
 }
示例#14
0
    public Monster CreateMonster(int loadedLevel, int waypoint, GameObject enemyObj)
    {
        EnemyObject = enemyObj;

        monster = null;

        string minionName = "Generic Minion";
        string bossName = "Generic Boss";

        switch (loadedLevel)
        {
            case 1:
                minionName = "Troll Minion";
                bossName = "Troll King";
                break;
            case 2:
                minionName = "Golem Minion";
                bossName = "Golem Boss";
                break;
            case 3:
                minionName = "Lava Minion";
                bossName = "Lava Boss";
                break;
        }
        SpawnEnemy(minionName, bossName, loadedLevel, waypoint);
        Debug.Log("Building level " + loadedLevel + " Enemy.\nName: " + monster.Name + "\nWaypoint: " + waypoint);

        return monster;
    }
示例#15
0
 public override bool UseTactic(IGameEngineCore engine, Monster monster)
 {
     bool usedSkill = engine.MonsterSkillEngine.UseSkill(monster, MonsterSkillType.SlingStone, engine.Player.Position);
     if (usedSkill)
         UsedCooldown(monster, CooldownName, CooldownAmount);
     return usedSkill;
 }
示例#16
0
    public Monster(Monster data)
    {
        title = data.title;
        type = data.type;
        stats = data.stats;
        desc = data.desc;
        flavour = data.flavour;
        flines = data.flines;
        level = data.level;
        image = data.image;
        back = data.back;
        front = data.front;
        id = data.id;
        picture = data.picture;
        cardpower = data.cardpower;
        bannerframe = data.bannerframe;

        current_health = data.current_health;
        max_health = data.max_health;
        faith = data.faith;
        spirit = data.spirit;
        strength = data.strength;
        defense = data.defense;
        dexterity = data.dexterity;

        health_scale = data.health_scale;
        faith_scale = data.faith_scale;
        spirit_scale = data.spirit_scale;
        strength_scale = data.strength_scale;
        defense_scale = data.defense_scale;

        level = data.level;
    }
示例#17
0
    public static Character NewBandit(Vector3 location)
    {
        Monster mon = new Monster();
        mon.Name = "Bandit";

        if (UnityEngine.Random.value > 0.125)
            mon.MaleLayers.Add("TempSprites/Materials/bandit");
        else
        {
            mon.MaleLayers.Add("TempSprites/Materials/bandit_cheif");
            mon.Name = "Fancy Bandit";
        }

        mon.FemaleLayers = mon.MaleLayers;
        SetStats(mon, 2, 2, 2, 25);

        mon.AddSkill(SkillFactory.FindSkillByName("Swords"), 3);

        mon.InventoryItems.GoldCoins = (int)UnityEngine.Random.Range(20, 120);

        mon.EquipItem(ItemFactory.FindItemByName("Sword") as Equipment, Equipment.EquipmentLocation.Weapon);
        mon.EquipItem(ItemFactory.FindItemByName("Leather Armor") as Equipment, Equipment.EquipmentLocation.Torso);
        mon.BackpackItem(ItemFactory.FindItemByName("Watermelon"));

        mon.Smarts = new FightOrFlight(0.3f,0.5f);

        return AttachToGame(mon, location,1.25f);
    }
示例#18
0
 public void pickMateButton(MonsterUnit m)
 {
     Monster t = m.getUnit();
     unitMonster = new Monster(unitMonster, t);
     setColors();
     updateUnitText();
 }
示例#19
0
    public static Character NewSkellymans(Vector3 location)
    {
        Monster mon = new Monster();
        mon.Name = "Skellyman";

        bool isFancy = UnityEngine.Random.value < 0.25;
        if (!isFancy)
            mon.MaleLayers.Add("TempSprites/Materials/skeleton");
        else
        {
            mon.MaleLayers.Add("TempSprites/Materials/skeleton_chain");
            mon.Name = "Dire " + mon.Name;
        }

        mon.FemaleLayers = mon.MaleLayers;
        if (isFancy)
            SetStats(mon, 2, 1, 1, 25);
        else
            SetStats(mon, 3, 0, 2, 50);

        mon.AddSkill(SkillFactory.FindSkillByName("Swords"), isFancy ? 4 : 2);

        mon.InventoryItems.GoldCoins = 0;

        mon.EquipItem(ItemFactory.FindItemByName("Sword") as Equipment, Equipment.EquipmentLocation.Weapon);
        mon.EquipItem(ItemFactory.FindItemByName( isFancy ? " Mail Armor" : "Leather Armor") as Equipment, Equipment.EquipmentLocation.Torso);
           // mon.BackpackItem(ItemFactory.FindItemByName("Watermelon"));

        mon.Smarts = new FightToDeath(0.75f);

        return AttachToGame(mon, location,1.25f);
    }
 /**
  * Update plays the "Sleep" animation over and over
  */
 public virtual void Update( Monster _monster )
 {
     if( !_monster.animation.isPlaying )
     {
         _monster.animation.PlayQueued( "Sleep", QueueMode.CompleteOthers );
     }
 }
示例#21
0
		/// <summary>
		/// Constructor
		/// </summary>
		/// <param name="monster">monster handle</param>
		public MonsterState(Monster monster)
		{
			if (monster == null)
				throw new ArgumentNullException("monster");

			Monster = monster;
		}
示例#22
0
        public override bool UseTactic(IGameEngineCore engine, Monster monster)
        {
            if (IsPlayerVisible(engine, monster))
            {
                List<Point> pathToPlayer = GetPathToPlayer(engine, monster);

                if (IsNextToPlayer(engine, pathToPlayer))
                {
                    if (AttackPlayer(engine, monster))
                        return true;
                }

                if (HasPathToPlayer(engine, pathToPlayer))
                {
                    if (MoveOnPath(engine, pathToPlayer, monster))
                        return true;
                }
            }
            else
            {
                if (WalkTowardsLastKnownPosition(engine, monster))
                    return true;
            }
            WanderRandomly(engine, monster);   // We have nothing else to do, so wander                
            return true;
        }
示例#23
0
	public void AttackWithDelay(Monster monster, float delay, float delayToWait) {
		if (ready) {
			this.monster = monster;
			Invoke("Attack", delay);
			Invoke("enablePlayerCanMove", delayToWait);
		}
	}
示例#24
0
    void Start()
    {
        monster = gameObject.GetComponent<Monster>();
        rigdBody = gameObject.GetComponent<Rigidbody>();
        agent = GetComponent<NavMeshAgent>();

        newPosition = true;
    }
示例#25
0
 // Use this for initialization
 void Start()
 {
     fly = 0;
     drag = false;
     monster = GameObject.Find("Monster").GetComponent<Monster>();
     tot_time = -1;
     attacking = false;
 }
示例#26
0
 public Battle(Player currentplayer, Monster monster)
 {
     player = currentplayer;
     this.monster = monster;
     playerTimer = monsterTimer = 0;
     nextAction = CombatAction.Attack;
     nextActionItem = player.EquippedWeapon;
 }
 Monster spawnMonster(string name, float x, float y)
 {
     Monster battler = new Monster(name);
     battler.Sprite.LocalPriority = 0.45f;
     battler.LocalPixelPosition = new Vector2(x, y);
     //this.battlers.Add(battler);
     return battler;
 }
示例#28
0
 void attack(Monster target)
 {
     if (canUseTP ()) {
         consumeTP ();
         playAttackAnimation ();
         target.OnAttack (damage);
     }
 }
示例#29
0
 // Use this for initialization
 void Awake()
 {
     monster = gameObject.GetComponent<Monster>();
     //gameObject.GetComponent<CharacterController>().detectCollisions = true;
     Player = GameObject.Find("Player");
     agent = GetComponent<NavMeshAgent>();
     //rigdBody.isKinematic = true;
 }
示例#30
0
		/// <summary>
		/// Constructor
		/// </summary>
		/// <param name="node">Xml node</param>
		public MonsterForm(XmlNode node)
		{
			InitializeComponent();

			Monster = new Monster();
			Monster.Load(node);
		//	MonsterBox.SetMonster(Monster);
		}
示例#31
0
        public MonsterInfo(BinaryReader reader)
        {
            Index = reader.ReadInt32();
            Name  = reader.ReadString();

            Image  = (Monster)reader.ReadUInt16();
            AI     = reader.ReadByte();
            Effect = reader.ReadByte();
            if (Envir.LoadVersion < 62)
            {
                Level = (ushort)reader.ReadByte();
            }
            else
            {
                Level = reader.ReadUInt16();
            }

            ViewRange = reader.ReadByte();
            CoolEye   = reader.ReadByte();

            HP = reader.ReadUInt32();

            if (Envir.LoadVersion < 62)
            {
                MinAC  = (ushort)reader.ReadByte();
                MaxAC  = (ushort)reader.ReadByte();
                MinMAC = (ushort)reader.ReadByte();
                MaxMAC = (ushort)reader.ReadByte();
                MinDC  = (ushort)reader.ReadByte();
                MaxDC  = (ushort)reader.ReadByte();
                MinMC  = (ushort)reader.ReadByte();
                MaxMC  = (ushort)reader.ReadByte();
                MinSC  = (ushort)reader.ReadByte();
                MaxSC  = (ushort)reader.ReadByte();
            }
            else
            {
                MinAC  = reader.ReadUInt16();
                MaxAC  = reader.ReadUInt16();
                MinMAC = reader.ReadUInt16();
                MaxMAC = reader.ReadUInt16();
                MinDC  = reader.ReadUInt16();
                MaxDC  = reader.ReadUInt16();
                MinMC  = reader.ReadUInt16();
                MaxMC  = reader.ReadUInt16();
                MinSC  = reader.ReadUInt16();
                MaxSC  = reader.ReadUInt16();
            }

            Accuracy = reader.ReadByte();
            Agility  = reader.ReadByte();
            Light    = reader.ReadByte();

            AttackSpeed = reader.ReadUInt16();
            MoveSpeed   = reader.ReadUInt16();
            Experience  = reader.ReadUInt32();

            CanPush = reader.ReadBoolean();
            CanTame = reader.ReadBoolean();

            if (Envir.LoadVersion < 18)
            {
                return;
            }
            AutoRev = reader.ReadBoolean();
            Undead  = reader.ReadBoolean();
        }
示例#32
0
 public BehaviourMonsterAI(Monster monster)
     : base(monster)
 {
 }
 public MonsterDetailViewModel(Monster mon = null)
 {
     Title = mon.Name;
     Mon   = mon;
 }
 public void MonsterCaptured(Monster monster)
 {
     GameController.Team.Add(monster);
     SceneManager.LoadScene("Map");
 }
示例#35
0
        private bool AStarMove(Monster sprite, Point p, int action)
        {
            Point srcPoint = sprite.Coordinate;
            Point start    = new Point
            {
                X = srcPoint.X / 20.0,
                Y = srcPoint.Y / 20.0
            };
            Point end = new Point
            {
                X = p.X / 20.0,
                Y = p.Y / 20.0
            };
            bool result;

            if (start.X == end.X && start.Y == end.Y)
            {
                result = true;
            }
            else
            {
                GameMap gameMap = GameManager.MapMgr.DictMaps[sprite.MonsterZoneNode.MapCode];
                if (start != end)
                {
                    List <ANode> path = null;
                    gameMap.MyNodeGrid.setStartNode((int)start.X, (int)start.Y);
                    gameMap.MyNodeGrid.setEndNode((int)end.X, (int)end.Y);
                    try
                    {
                        path = gameMap.MyAStarFinder.find(gameMap.MyNodeGrid);
                    }
                    catch (Exception)
                    {
                        sprite.DestPoint = new Point(-1.0, -1.0);
                        LogManager.WriteLog(LogTypes.Error, string.Format("AStar怪物寻路失败, ExtenstionID={0}, Start=({1},{2}), End=({3},{4}), fixedObstruction=({5},{6})", new object[]
                        {
                            sprite.MonsterInfo.ExtensionID,
                            (int)start.X,
                            (int)start.Y,
                            (int)end.X,
                            (int)end.Y,
                            gameMap.MyNodeGrid.numCols,
                            gameMap.MyNodeGrid.numRows
                        }), null, true);
                        return(false);
                    }
                    if (path == null || path.Count <= 1)
                    {
                        Point maxPoint;
                        if (this.FindLinearNoObsMaxPoint(gameMap, sprite, p, out maxPoint))
                        {
                            path = null;
                            end  = new Point
                            {
                                X = maxPoint.X / (double)gameMap.MapGridWidth,
                                Y = maxPoint.Y / (double)gameMap.MapGridHeight
                            };
                            p = maxPoint;
                            gameMap.MyNodeGrid.setStartNode((int)start.X, (int)start.Y);
                            gameMap.MyNodeGrid.setEndNode((int)end.X, (int)end.Y);
                            path = gameMap.MyAStarFinder.find(gameMap.MyNodeGrid);
                        }
                    }
                    if (path == null || path.Count <= 1)
                    {
                        sprite.DestPoint = new Point(-1.0, -1.0);
                        sprite.Action    = GActions.Stand;
                        Global.RemoveStoryboard(sprite.Name);
                        return(false);
                    }
                    sprite.Destination = p;
                    double UnitCost = (double)Data.RunUnitCost;
                    UnitCost /= sprite.MoveSpeed;
                    UnitCost  = 20.0 / UnitCost * (double)Global.MovingFrameRate;
                    UnitCost *= 0.5;
                    StoryBoardEx.RemoveStoryBoard(sprite.Name);
                    StoryBoardEx sb = new StoryBoardEx(sprite.Name);
                    sb.Completed = new StoryBoardEx.CompletedDelegateHandle(this.Move_Completed);
                    Point firstPoint = new Point((double)(path[0].x * gameMap.MapGridWidth), (double)(path[0].y * gameMap.MapGridHeight));
                    sprite.Direction = this.CalcDirection(sprite.Coordinate, firstPoint);
                    sprite.Action    = (GActions)action;
                    sb.Binding();
                    sprite.FirstStoryMove = true;
                    sb.Start(sprite, path, UnitCost, 20);
                }
                result = true;
            }
            return(result);
        }
示例#36
0
 public MilethBoss(Monster monster, Area map)
     : base(monster, map)
 {
 }
示例#37
0
 public void AddMonster(Monster mob)
 {
     _goldenMob.Add(mob);
     mob.Die += Gold_Die;
 }
示例#38
0
 public Spells(Monster monster)
 {
     Monster    = monster;
     _spellList = new Dictionary <Spell, SpellInfo>();
     _buffs     = new List <Buff>();
 }
示例#39
0
 public static bool IsLessThanHalfHealth(Monster m)
 {
     return(m.Health < m.MaxHealth / 2);
 }
示例#40
0
        public void monsterCreationTest()
        {
            Monster m1 = new Monster("slime");

            Assert.AreEqual("slime", m1.Name);
        }
        private void CanCreateNewFlatBufferFromScratch(bool sizePrefix)
        {
            // Second, let's create a FlatBuffer from scratch in C#, and test it also.
            // We use an initial size of 1 to exercise the reallocation algorithm,
            // normally a size larger than the typical FlatBuffer you generate would be
            // better for performance.
            var fbb = new FlatBufferBuilder(1);

            StringOffset[]     names = { fbb.CreateString("Frodo"), fbb.CreateString("Barney"), fbb.CreateString("Wilma") };
            Offset <Monster>[] off   = new Offset <Monster> [3];
            Monster.StartMonster(fbb);
            Monster.AddName(fbb, names[0]);
            off[0] = Monster.EndMonster(fbb);
            Monster.StartMonster(fbb);
            Monster.AddName(fbb, names[1]);
            off[1] = Monster.EndMonster(fbb);
            Monster.StartMonster(fbb);
            Monster.AddName(fbb, names[2]);
            off[2] = Monster.EndMonster(fbb);
            var sortMons = Monster.CreateSortedVectorOfMonster(fbb, off);

            // We set up the same values as monsterdata.json:

            var str   = fbb.CreateString("MyMonster");
            var test1 = fbb.CreateString("test1");
            var test2 = fbb.CreateString("test2");


            Monster.StartInventoryVector(fbb, 5);
            for (int i = 4; i >= 0; i--)
            {
                fbb.AddByte((byte)i);
            }
            var inv = fbb.EndVector();

            var fred = fbb.CreateString("Fred");

            Monster.StartMonster(fbb);
            Monster.AddName(fbb, fred);
            var mon2 = Monster.EndMonster(fbb);

            Monster.StartTest4Vector(fbb, 2);
            MyGame.Example.Test.CreateTest(fbb, (short)10, (sbyte)20);
            MyGame.Example.Test.CreateTest(fbb, (short)30, (sbyte)40);
            var test4 = fbb.EndVector();

            Monster.StartTestarrayofstringVector(fbb, 2);
            fbb.AddOffset(test2.Value);
            fbb.AddOffset(test1.Value);
            var testArrayOfString = fbb.EndVector();

            Monster.StartMonster(fbb);
            Monster.AddPos(fbb, Vec3.CreateVec3(fbb, 1.0f, 2.0f, 3.0f, 3.0,
                                                Color.Green, (short)5, (sbyte)6));
            Monster.AddHp(fbb, (short)80);
            Monster.AddName(fbb, str);
            Monster.AddInventory(fbb, inv);
            Monster.AddTestType(fbb, Any.Monster);
            Monster.AddTest(fbb, mon2.Value);
            Monster.AddTest4(fbb, test4);
            Monster.AddTestarrayofstring(fbb, testArrayOfString);
            Monster.AddTestbool(fbb, false);
            Monster.AddTestarrayoftables(fbb, sortMons);
            var mon = Monster.EndMonster(fbb);

            if (sizePrefix)
            {
                Monster.FinishSizePrefixedMonsterBuffer(fbb, mon);
            }
            else
            {
                Monster.FinishMonsterBuffer(fbb, mon);
            }

            // Dump to output directory so we can inspect later, if needed
#if ENABLE_SPAN_T
            var    data     = fbb.DataBuffer.ToSizedArray();
            string filename = @"Resources/monsterdata_cstest" + (sizePrefix ? "_sp" : "") + ".mon";
            File.WriteAllBytes(filename, data);
#else
            using (var ms = fbb.DataBuffer.ToMemoryStream(fbb.DataBuffer.Position, fbb.Offset))
            {
                var    data     = ms.ToArray();
                string filename = @"Resources/monsterdata_cstest" + (sizePrefix ? "_sp" : "") + ".mon";
                File.WriteAllBytes(filename, data);
            }
#endif

            // Remove the size prefix if necessary for further testing
            ByteBuffer dataBuffer = fbb.DataBuffer;
            if (sizePrefix)
            {
                Assert.AreEqual(ByteBufferUtil.GetSizePrefix(dataBuffer) + FlatBufferConstants.SizePrefixLength,
                                dataBuffer.Length - dataBuffer.Position);
                dataBuffer = ByteBufferUtil.RemoveSizePrefix(dataBuffer);
            }

            // Now assert the buffer
            TestBuffer(dataBuffer);

            //Attempt to mutate Monster fields and check whether the buffer has been mutated properly
            // revert to original values after testing
            Monster monster = Monster.GetRootAsMonster(dataBuffer);


            // mana is optional and does not exist in the buffer so the mutation should fail
            // the mana field should retain its default value
            Assert.AreEqual(monster.MutateMana((short)10), false);
            Assert.AreEqual(monster.Mana, (short)150);

            // Accessing a vector of sorted by the key tables
            Assert.AreEqual(monster.Testarrayoftables(0).Value.Name, "Barney");
            Assert.AreEqual(monster.Testarrayoftables(1).Value.Name, "Frodo");
            Assert.AreEqual(monster.Testarrayoftables(2).Value.Name, "Wilma");

            // Example of searching for a table by the key
            Assert.IsTrue(monster.TestarrayoftablesByKey("Frodo") != null);
            Assert.IsTrue(monster.TestarrayoftablesByKey("Barney") != null);
            Assert.IsTrue(monster.TestarrayoftablesByKey("Wilma") != null);

            // testType is an existing field and mutating it should succeed
            Assert.AreEqual(monster.TestType, Any.Monster);
            Assert.AreEqual(monster.MutateTestType(Any.NONE), true);
            Assert.AreEqual(monster.TestType, Any.NONE);
            Assert.AreEqual(monster.MutateTestType(Any.Monster), true);
            Assert.AreEqual(monster.TestType, Any.Monster);

            //mutate the inventory vector
            Assert.AreEqual(monster.MutateInventory(0, 1), true);
            Assert.AreEqual(monster.MutateInventory(1, 2), true);
            Assert.AreEqual(monster.MutateInventory(2, 3), true);
            Assert.AreEqual(monster.MutateInventory(3, 4), true);
            Assert.AreEqual(monster.MutateInventory(4, 5), true);

            for (int i = 0; i < monster.InventoryLength; i++)
            {
                Assert.AreEqual(monster.Inventory(i), i + 1);
            }

            //reverse mutation
            Assert.AreEqual(monster.MutateInventory(0, 0), true);
            Assert.AreEqual(monster.MutateInventory(1, 1), true);
            Assert.AreEqual(monster.MutateInventory(2, 2), true);
            Assert.AreEqual(monster.MutateInventory(3, 3), true);
            Assert.AreEqual(monster.MutateInventory(4, 4), true);

            // get a struct field and edit one of its fields
            Vec3 pos = (Vec3)monster.Pos;
            Assert.AreEqual(pos.X, 1.0f);
            pos.MutateX(55.0f);
            Assert.AreEqual(pos.X, 55.0f);
            pos.MutateX(1.0f);
            Assert.AreEqual(pos.X, 1.0f);

            TestBuffer(dataBuffer);
        }
示例#42
0
 private void Awake()
 {
     monster = GetComponent <Monster>();
 }
        private void TestBuffer(ByteBuffer bb)
        {
            Monster monster = Monster.GetRootAsMonster(bb);

            Assert.AreEqual(80, monster.Hp);
            Assert.AreEqual(150, monster.Mana);
            Assert.AreEqual("MyMonster", monster.Name);

            var pos = monster.Pos.Value;

            Assert.AreEqual(1.0f, pos.X);
            Assert.AreEqual(2.0f, pos.Y);
            Assert.AreEqual(3.0f, pos.Z);

            Assert.AreEqual(3.0f, pos.Test1);
            Assert.AreEqual(Color.Green, pos.Test2);
            var t = (MyGame.Example.Test)pos.Test3;

            Assert.AreEqual((short)5, t.A);
            Assert.AreEqual((sbyte)6, t.B);

            Assert.AreEqual(Any.Monster, monster.TestType);

            var monster2 = monster.Test <Monster>().Value;

            Assert.AreEqual("Fred", monster2.Name);


            Assert.AreEqual(5, monster.InventoryLength);
            var invsum = 0;

            for (var i = 0; i < monster.InventoryLength; i++)
            {
                invsum += monster.Inventory(i);
            }
            Assert.AreEqual(10, invsum);

            // Get the inventory as an array and subtract the
            // sum to get it back to 0
            var inventoryArray = monster.GetInventoryArray();

            Assert.AreEqual(5, inventoryArray.Length);
            foreach (var inv in inventoryArray)
            {
                invsum -= inv;
            }
            Assert.AreEqual(0, invsum);

            var test0 = monster.Test4(0).Value;
            var test1 = monster.Test4(1).Value;

            Assert.AreEqual(2, monster.Test4Length);

            Assert.AreEqual(100, test0.A + test0.B + test1.A + test1.B);

            Assert.AreEqual(2, monster.TestarrayofstringLength);
            Assert.AreEqual("test1", monster.Testarrayofstring(0));
            Assert.AreEqual("test2", monster.Testarrayofstring(1));

            Assert.AreEqual(false, monster.Testbool);

#if ENABLE_SPAN_T
            var nameBytes = monster.GetNameBytes();
            Assert.AreEqual("MyMonster", Encoding.UTF8.GetString(nameBytes.ToArray(), 0, nameBytes.Length));

            if (0 == monster.TestarrayofboolsLength)
            {
                Assert.IsFalse(monster.GetTestarrayofboolsBytes().Length != 0);
            }
            else
            {
                Assert.IsTrue(monster.GetTestarrayofboolsBytes().Length == 0);
            }
#else
            var nameBytes = monster.GetNameBytes().Value;
            Assert.AreEqual("MyMonster", Encoding.UTF8.GetString(nameBytes.Array, nameBytes.Offset, nameBytes.Count));

            if (0 == monster.TestarrayofboolsLength)
            {
                Assert.IsFalse(monster.GetTestarrayofboolsBytes().HasValue);
            }
            else
            {
                Assert.IsTrue(monster.GetTestarrayofboolsBytes().HasValue);
            }
#endif
        }
示例#44
0
        public void TestWrathfulSmite()
        {
            AllPlayers.Invalidate();
            AllSpells.Invalidate();
            AllActionShortcuts.Invalidate();
            Character            ava        = AllPlayers.GetFromId(PlayerID.Ava);
            PlayerActionShortcut greatsword = ava.GetShortcut("Greatsword");

            Assert.IsNotNull(greatsword);
            Monster joeVineBlight = MonsterBuilder.BuildVineBlight("Joe");

            List <PlayerActionShortcut> wrathfulSmites = AllActionShortcuts.Get(ava.playerID, SpellNames.WrathfulSmite);

            Assert.AreEqual(1, wrathfulSmites.Count);
            PlayerActionShortcut wrathfulSmite = wrathfulSmites[0];

            Assert.IsNotNull(wrathfulSmite);

            DndGame game = DndGame.Instance;

            game.GetReadyToPlay();
            game.AddPlayer(ava);
            game.AddMonster(joeVineBlight);
            DateTime gameStartTime = game.Time;

            game.EnteringCombat();

            ava.Hits(joeVineBlight, greatsword);        // Action. Ava is first to fight.
            ava.Cast(wrathfulSmite.Spell);              // Bonus Action - Wrathful Smite lasts for one minute.
            Assert.IsTrue(ava.SpellIsActive(SpellNames.WrathfulSmite));

            joeVineBlight.Misses(ava, AttackNames.Constrict);

            AvaMeleeMissesJoe();                        // Round 2
            Assert.AreEqual(6, game.SecondsSince(gameStartTime));

            joeVineBlight.Misses(ava, AttackNames.Constrict);
            Assert.AreEqual(6, game.SecondsSince(gameStartTime));

            AvaMeleeMissesJoe();                // Round 3
            Assert.AreEqual(12, game.SecondsSince(gameStartTime));

            joeVineBlight.Misses(ava, AttackNames.Constrict);
            Assert.AreEqual(12, game.SecondsSince(gameStartTime));

            AvaMeleeMissesJoe();
            Assert.AreEqual(18, game.SecondsSince(gameStartTime));

            joeVineBlight.Misses(ava, AttackNames.Constrict);
            Assert.AreEqual(18, game.SecondsSince(gameStartTime));

            //`+++NOW THE HIT....
            ava.Hits(joeVineBlight, greatsword);
            Assert.AreEqual(24, game.SecondsSince(gameStartTime));

            Assert.IsTrue(ava.SpellIsActive(SpellNames.WrathfulSmite));              // Wrathful Smite spell is not yet dispelled, however its impact on attack rolls is done.

            Assert.AreEqual($"Target must make a Wisdom saving throw or be frightened of {ava.name} until the spell ends. As an action, the creature can make a Wisdom check against {ava.name}'s spell save DC ({ava.GetSpellSaveDC()}) to steel its resolve and end this {wrathfulSmite.Spell.Name} spell.", game.lastMessageSentToDungeonMaster);

            joeVineBlight.Misses(ava, AttackNames.Constrict);
            Assert.AreEqual(24, game.SecondsSince(gameStartTime));

            ava.Misses(joeVineBlight, greatsword);              // Advancing Round (Ava's turn again).
            Assert.AreEqual("", ava.additionalDiceThisRoll);    // No more die roll effects.
            Assert.AreEqual("", ava.trailingEffectsThisRoll);
            Assert.AreEqual("", ava.dieRollEffectsThisRoll);
            Assert.AreEqual("", ava.dieRollMessageThisRoll);

            Assert.AreEqual(30, game.SecondsSince(gameStartTime));
            game.AdvanceClock(DndTimeSpan.FromSeconds(30));

            Assert.IsFalse(ava.SpellIsActive(SpellNames.WrathfulSmite));              // Wrathful Smite spell should finally be dispelled.

            void AvaMeleeMissesJoe()
            {
                Assert.AreEqual("", ava.additionalDiceThisRoll);
                Assert.AreEqual("", ava.trailingEffectsThisRoll);
                Assert.AreEqual("", ava.dieRollEffectsThisRoll);
                Assert.AreEqual("", ava.dieRollMessageThisRoll);
                ava.Misses(joeVineBlight, greatsword);                  // Advancing Round (Ava's turn again).
                Assert.AreEqual("1d6(psychic)", ava.additionalDiceThisRoll);
                Assert.AreEqual("Ravens;Spirals", ava.trailingEffectsThisRoll);
                Assert.AreEqual("PaladinSmite", ava.dieRollEffectsThisRoll);
                Assert.AreEqual("Wrathful Smite", ava.dieRollMessageThisRoll);
                Assert.IsTrue(ava.SpellIsActive(SpellNames.WrathfulSmite));
            }
        }
示例#45
0
 // Choose whether to threaten, panic, or just keep wandering when another monster wanders into range.
 protected override State ChooseThreatenOffensive(Monster other)
 {
     return(State.IGNORE);
 }
示例#46
0
 // Choose whether to threaten, panic, or just keep wandering when another monster threatens.
 protected override State ChooseThreatenDefensive(Monster other)
 {
     return(State.FLEE);
 }
        public bool Act(Monster monster, CommandSystem commandSystem)
        {
            DungeonMap  dungeonMap = Game.DungeonMap;
            Player      player     = Game.Player;
            FieldOfView monsterFov = new FieldOfView(dungeonMap);

            //if the monster has not been alerted, compute a FOV. Use monsters awareness value for the distance in the fov check.
            //If the player is in the monsters FoV, then alert it. Add a message to the MessageLog regarding this alerted status

            if (!monster.TurnsAlerted.HasValue)
            {
                monsterFov.ComputeFov(monster.X, monster.Y, monster.Awareness, true);
                if (monsterFov.IsInFov(player.X, player.Y))
                {
                    Game.MessageLog.Add($"{monster.Name} is eager to fight {player.Name}");
                    monster.TurnsAlerted = 1;
                }
            }

            if (monster.TurnsAlerted.HasValue)
            {
                //Before we find a path, make sure to make the monster and player cells walkable.
                dungeonMap.SetIsWalkable(monster.X, monster.Y, true);
                dungeonMap.SetIsWalkable(player.X, player.Y, true);

                PathFinder pathFinder = new PathFinder(dungeonMap);
                Path       path       = null;

                try
                {
                    path = pathFinder.ShortestPath(
                        dungeonMap.GetCell(monster.X, monster.Y),
                        dungeonMap.GetCell(player.X, player.Y));
                }
                catch (PathNotFoundException)
                {
                    // The monster can see the player, but cannot find a path to him
                    // This could be due to other monsters blocking the way
                    // Add a message to the message log that the monster is waiting
                    Game.MessageLog.Add($"{monster.Name} waits for a turn");
                }

                //Dont forget to set the walkable status back to false
                dungeonMap.SetIsWalkable(monster.X, monster.Y, false);
                dungeonMap.SetIsWalkable(player.X, player.Y, false);

                //In the case that there was a path, tell the CommandSystem to move the monster
                if (path != null)
                {
                    try
                    {
                        //TODO: This should be a path.StepForward but there is a bug in RogueSharp V3
                        //The bug is that a path returned from a pathfinder does not include the source cell.
                        commandSystem.MoveMonster(monster, path.StepForward());
                    }
                    catch (NoMoreStepsException)
                    {
                        Game.MessageLog.Add($"{monster.Name} growls in frustration");
                    }
                }

                monster.TurnsAlerted++;

                //Lose alerted status every 15 turns. As long as the plyer is still in FoV, the monster will stay alert.
                //Otherwise, the monster will quit chasing the palyer.
                if (monster.TurnsAlerted > 15)
                {
                    monster.TurnsAlerted = null;
                }
            }
            return(true);
        }
        private void MoveTo(Location newLocation)
        {
            if (!_player.HasRequiredItemToEnterThisLocation(newLocation))
            {
                rtbMessages.Text += "You must have a " + newLocation.ItemRequiredToEnter.Name +
                                    " to enter this location." + Environment.NewLine;
                return;
            }

            //Update the player's current location
            _player.CurrentLocation = newLocation;

            //Show/hide available movements buttons
            btnNorth.Visible = (newLocation.LocationToNorth != null);
            btnEast.Visible  = (newLocation.LocationToEast != null);
            btnSouth.Visible = (newLocation.LocationToSouth != null);
            btnWest.Visible  = (newLocation.LocationToWest != null);

            //Display current location name and description
            rtbLocation.Text  = newLocation.Name + Environment.NewLine;
            rtbLocation.Text += newLocation.Description + Environment.NewLine;

            //Completely heal the player
            _player.CurrentHitPoints = _player.MaximumHitPoints;

            //Update Hit Points in UI
            lblHitPoints.Text = _player.CurrentHitPoints.ToString();

            //Does the location have a quest?
            if (newLocation.QuestAvailableHere != null)
            {
                //See if the player already has the quest and if they have completed it
                bool playerAlreadyHasQuest       = _player.HasThisQuest(newLocation.QuestAvailableHere);
                bool playerAlreadyCompletedQuest = _player.CompletedThisQuest(newLocation.QuestAvailableHere);
                if (playerAlreadyHasQuest)
                {
                    //if not completed the quest yet
                    if (!playerAlreadyCompletedQuest)
                    {
                        //See if the player has all needed to complete the quest
                        bool playerHasAllItemsToCompleteQuest =
                            _player.HasAllQuestCompletionItem(newLocation.QuestAvailableHere);

                        //The player has all item required
                        if (playerHasAllItemsToCompleteQuest)
                        {
                            //Display massage
                            rtbMessages.Text += Environment.NewLine;
                            rtbMessages.Text += "You complete the " + newLocation.QuestAvailableHere.Name +
                                                " quest." + Environment.NewLine;

                            //Remove quest items from inventory
                            _player.RemoveQuestCompletionItem(newLocation.QuestAvailableHere);

                            //Give quest rewards
                            rtbMessages.Text += "You receive: " + Environment.NewLine;
                            rtbMessages.Text += newLocation.QuestAvailableHere.RewardExperiencePoints.ToString() +
                                                "experience points" + Environment.NewLine;
                            rtbMessages.Text += newLocation.QuestAvailableHere.RewardGold.ToString() + "gold" +
                                                Environment.NewLine;
                            rtbMessages.Text += newLocation.QuestAvailableHere.RewardItem.Name +
                                                Environment.NewLine;

                            _player.ExperiencePoints += newLocation.QuestAvailableHere.RewardExperiencePoints;
                            _player.Gold             += newLocation.QuestAvailableHere.RewardGold;

                            //Add the reward
                            _player.AddItemToInventory(newLocation.QuestAvailableHere.RewardItem);

                            //Mark the quest as completed
                            _player.MarkQuestCompleted(newLocation.QuestAvailableHere);
                        }
                    }
                }
                else
                {
                    //The player does not already have the quest
                    //Display the messages
                    rtbMessages.Text += "You receive the " + newLocation.QuestAvailableHere.Name + " quest." +
                                        Environment.NewLine;
                    rtbMessages.Text += newLocation.QuestAvailableHere.Description + Environment.NewLine;
                    rtbMessages.Text += "To complete it, return with:" + Environment.NewLine;
                    foreach (QuestCompletionItem qci in newLocation.QuestAvailableHere.QuestCompletionItems)
                    {
                        if (qci.Quantity == 1)
                        {
                            rtbMessages.Text += qci.Quantity.ToString() + " " + qci.Details.Name +
                                                Environment.NewLine;
                        }
                        else
                        {
                            rtbMessages.Text += qci.Quantity.ToString() + " " + qci.Details.NamePlural +
                                                Environment.NewLine;
                        }
                    }
                    rtbMessages.Text += Environment.NewLine;

                    //Add the quest to the playe's quest list
                    _player.Quests.Add(new PlayerQuest(newLocation.QuestAvailableHere));
                }
            }

            //Does the location have a monster?
            if (newLocation.MonsterLivingHere != null)
            {
                rtbMessages.Text += "You see a " + newLocation.MonsterLivingHere.Name + Environment.NewLine;

                //Make a new monster,using the values from the standart monster in the World.Monster list
                Monster standartMonster = World.MonsterByID(newLocation.MonsterLivingHere.ID);

                _currentMonster = new Monster(standartMonster.ID, standartMonster.Name,
                                              standartMonster.MaximumDamage, standartMonster.RewardExperiencePoints,
                                              standartMonster.RewardGold, standartMonster.CurrentHitPoints, standartMonster.MaximumHitPoints);

                foreach (LootItem lootItem in standartMonster.LootTable)
                {
                    _currentMonster.LootTable.Add(lootItem);
                }

                cboWeapons.Visible   = true;
                cboPotions.Visible   = true;
                btnUseWeapon.Visible = true;
                btnUsePotion.Visible = true;
            }
            else
            {
                _currentMonster = null;

                cboWeapons.Visible   = false;
                cboPotions.Visible   = false;
                btnUseWeapon.Visible = false;
                btnUsePotion.Visible = false;
            }

            //Update player's inventory list
            UpdateInventoryListUI();

            //Refresh player's quest list
            UpdateQuestListInUI();

            //Update player's weapons combobox
            UpdateWeaponsListInUI();

            //Update player's potion combobox
            UpdatePotionListInUI();

            //Update player's stats
            UpdatePlayerStats();
        }
示例#49
0
 private void MonsterCreated(Monster monster)
 {
     MonstersToCreate.Add(monster);
 }
        public void processEvent(EventObject eventObject)
        {
            //System.Diagnostics.Debug.WriteLine(string.Format("Boss AI Event Listener, EventType={0}", (EventTypes)eventObject.getEventType()));

            List <BossAIItem> bossAIItemList        = null;
            Monster           monster               = null;
            GameClient        gameClient            = null;
            List <BossAIItem> allDeadBossAIItemList = null;

            List <BossAIItem> execBossAIItemList = new List <BossAIItem>();

            if (eventObject.getEventType() == (int)EventTypes.MonsterBirthOn)
            {
                monster = (eventObject as MonsterBirthOnEventObject).getMonster();
                int AIID = monster.MonsterInfo.AIID;

                if (AIID > 0)
                {
                    bossAIItemList = BossAICachingMgr.FindCachingItem(AIID, (int)BossAITriggerTypes.BirthOn);
                    if (null != bossAIItemList)
                    {
                        lock (monster.TriggerMutex)
                        {
                            for (int i = 0; i < bossAIItemList.Count; i++)
                            {
                                if (!monster.CanExecBossAI(bossAIItemList[i]))
                                {
                                    continue; //如果不能执行,则跳过
                                }


                                monster.RecBossAI(bossAIItemList[i]);
                                execBossAIItemList.Add(bossAIItemList[i]);
                            }
                        }
                    }
                }
            }
            else if (eventObject.getEventType() == (int)EventTypes.MonsterDead)
            {
                monster    = (eventObject as MonsterDeadEventObject).getMonster();
                gameClient = (eventObject as MonsterDeadEventObject).getAttacker();

                int AIID = monster.MonsterInfo.AIID;

                if (AIID > 0)
                {
                    bossAIItemList = BossAICachingMgr.FindCachingItem(AIID, (int)BossAITriggerTypes.Dead);

                    if (null != bossAIItemList)
                    {
                        lock (monster.TriggerMutex)
                        {
                            for (int i = 0; i < bossAIItemList.Count; i++)
                            {
                                if (!monster.CanExecBossAI(bossAIItemList[i]))
                                {
                                    continue; //如果不能执行
                                }

                                monster.RecBossAI(bossAIItemList[i]);
                                execBossAIItemList.Add(bossAIItemList[i]);
                            }
                        }
                    }

                    allDeadBossAIItemList = BossAICachingMgr.FindCachingItem(AIID, (int)BossAITriggerTypes.DeadAll);
                    if (null != allDeadBossAIItemList)
                    {
                        for (int i = 0; i < allDeadBossAIItemList.Count; i++)
                        {
                            if (!monster.CanExecBossAI(allDeadBossAIItemList[i]))
                            {
                                continue; //如果不能执行
                            }

                            bool       toContinue    = false;
                            List <int> monsterIDList = (allDeadBossAIItemList[i].Condition as AllDeadCondition).MonsterIDList;
                            for (int j = 0; j < monsterIDList.Count; j++)
                            {
                                List <object> findMonsters = GameManager.MonsterMgr.FindMonsterByExtensionID(monster.CurrentCopyMapID, monsterIDList[j]);
                                if (findMonsters.Count > 0)
                                {
                                    toContinue = true;
                                    break;
                                }
                            }

                            if (toContinue)
                            {
                                continue;
                            }

                            monster.RecBossAI(allDeadBossAIItemList[i]);
                            execBossAIItemList.Add(allDeadBossAIItemList[i]);
                        }
                    }
                }
            }
            else if (eventObject.getEventType() == (int)EventTypes.MonsterInjured)
            {
                monster    = (eventObject as MonsterInjuredEventObject).getMonster();
                gameClient = (eventObject as MonsterInjuredEventObject).getAttacker();

                int AIID = monster.MonsterInfo.AIID;

                if (AIID > 0)
                {
                    bossAIItemList = BossAICachingMgr.FindCachingItem(AIID, (int)BossAITriggerTypes.Injured);

                    if (null != bossAIItemList)
                    {
                        lock (monster.TriggerMutex)
                        {
                            for (int i = 0; i < bossAIItemList.Count; i++)
                            {
                                if (!monster.CanExecBossAI(bossAIItemList[i]))
                                {
                                    continue; //如果不能执行
                                }

                                monster.RecBossAI(bossAIItemList[i]);
                                execBossAIItemList.Add(bossAIItemList[i]);
                            }
                        }
                    }
                }
            }
            else if (eventObject.getEventType() == (int)EventTypes.MonsterAttacked)
            {
                monster = (eventObject as MonsterAttackedEventObject).getMonster();

                int AIID = monster.MonsterInfo.AIID;

                if (AIID > 0)
                {
                    bossAIItemList = BossAICachingMgr.FindCachingItem(AIID, (int)BossAITriggerTypes.Attacked);

                    if (null != bossAIItemList)
                    {
                        lock (monster.TriggerMutex)
                        {
                            for (int i = 0; i < bossAIItemList.Count; i++)
                            {
                                if (!monster.CanExecBossAI(bossAIItemList[i]))
                                {
                                    continue; //如果不能执行
                                }

                                monster.RecBossAI(bossAIItemList[i]);
                                execBossAIItemList.Add(bossAIItemList[i]);
                            }
                        }
                    }
                }
            }
            else if (eventObject.getEventType() == (int)EventTypes.MonsterBlooadChanged)
            {
                monster = (eventObject as MonsterBlooadChangedEventObject).getMonster();
                int AIID = monster.MonsterInfo.AIID;

                if (AIID > 0)
                {
                    bossAIItemList = BossAICachingMgr.FindCachingItem(AIID, (int)BossAITriggerTypes.BloodChanged);

                    if (null != bossAIItemList)
                    {
                        lock (monster.TriggerMutex)
                        {
                            for (int i = 0; i < bossAIItemList.Count; i++)
                            {
                                if (!monster.CanExecBossAI(bossAIItemList[i]))
                                {
                                    continue; //如果不能执行
                                }

                                double currentLifeVPercent = monster.VLife / monster.MonsterInfo.VLifeMax;
                                bool   canExecActions      = (currentLifeVPercent >= (bossAIItemList[i].Condition as BloodChangedCondition).MinLifePercent && currentLifeVPercent <= (bossAIItemList[i].Condition as BloodChangedCondition).MaxLifePercent);

                                if (canExecActions)
                                {
                                    monster.RecBossAI(bossAIItemList[i]);
                                    execBossAIItemList.Add(bossAIItemList[i]);
                                }
                            }
                        }
                    }
                }
            }
            else if (eventObject.getEventType() == (int)EventTypes.MonsterLivingTime)
            {
                monster = (eventObject as MonsterLivingTimeEventObject).getMonster();
                int AIID = monster.MonsterInfo.AIID;

                if (AIID > 0)
                {
                    bossAIItemList = BossAICachingMgr.FindCachingItem(AIID, (int)BossAITriggerTypes.LivingTime);

                    if (null != bossAIItemList)
                    {
                        lock (monster.TriggerMutex)
                        {
                            for (int i = 0; i < bossAIItemList.Count; i++)
                            {
                                if (!monster.CanExecBossAI(bossAIItemList[i]))
                                {
                                    continue; //如果不能执行
                                }

                                bool canExecActions = monster.GetMonsterLivingTicks() >= ((bossAIItemList[i].Condition as LivingTimeCondition).LivingMinutes * 60 * 1000);
                                if (canExecActions)
                                {
                                    monster.RecBossAI(bossAIItemList[i]);
                                    execBossAIItemList.Add(bossAIItemList[i]);
                                }
                            }
                        }
                    }
                }
            }

            if (null != execBossAIItemList)
            {
                for (int i = 0; i < execBossAIItemList.Count; i++)
                {
                    BossAIItem             bossAIItem          = execBossAIItemList[i];
                    List <MagicActionItem> magicActionItemList = null;
                    if (GameManager.SystemMagicActionMgr.BossAIActionsDict.TryGetValue(bossAIItem.ID, out magicActionItemList) && null != magicActionItemList)
                    {
                        for (int j = 0; j < magicActionItemList.Count; j++)
                        {
                            MagicAction.ProcessAction(monster, gameClient, magicActionItemList[j].MagicActionID, magicActionItemList[j].MagicActionParams);

                            //向地图中的用户广播特殊提示信息
                            if (!string.IsNullOrEmpty(bossAIItem.Desc))
                            {
                                GameManager.ClientMgr.BroadSpecialHintText(monster.CurrentMapCode, monster.CurrentCopyMapID, bossAIItem.Desc);
                            }
                        }
                    }
                }
            }
        }
示例#51
0
 public void Initialize(Tower parent)
 {
     this.target      = parent.Target;
     this.parent      = parent;
     this.elementType = parent.ElementType;
 }
示例#52
0
 public ClickableMonsterComponent ToClickableMonsterComponent(Monster monster)
 {
     return(new ClickableMonsterComponent(monster, Texturename, 0, 0, Texturewidth * 4, Textureheight * 4, Texturewidth, Textureheight, StartingFrame, NumberOfFrames, AnimatingInterval, TextureColor));
 }
示例#53
0
    public override Actor GetDefaultTargetActor()
    {
        Monster monster = mRunningProperty.SelfActor as Monster;

        if (monster == null)
        {
            return(null);
        }

        //if (monster is Pet)
        //{
        //    if (!SceneHelp.Instance.IsInSingleInstance())
        //    {
        //        return null;
        //    }
        //}

        Actor targetActor = null;
        float shortest    = float.MaxValue;
        Actor localPlayer = Game.GetInstance().GetLocalPlayer();

        // 有没有强制目标
        //Spartan.MonsterGroupInfo monsterGroupInfo = monster.SpartanMonsterGroupInfo;

        //if(monsterGroupInfo != null)
        //{
        //    targetActor = NpcManager.Instance.GetNpcByNpcId((uint)monsterGroupInfo.TargetNpcId);

        //    if(targetActor != null && !targetActor.IsActorInvisiable)
        //    {
        //        return targetActor;
        //    }
        //}

        float viewRange = mRunningProperty.ViewRange * mRunningProperty.ViewRange;

        if (InstanceManager.Instance.IsPlayerVSPlayerType)
        {
            if (mRunningProperty.SelfActor.ParentActor == null)
            {
                return(null);
            }

            foreach (var item in ActorManager.Instance.PlayerSet)
            {
                Actor oppositeActor = null;

                if (item.Value.UID != mRunningProperty.SelfActor.ParentActor.UID)
                {
                    oppositeActor = item.Value;
                    float distanceSquare = AIHelper.DistanceSquare(mRunningProperty.SelfActorPos, item.Value.transform.position);
                    shortest = distanceSquare;

                    foreach (var son in oppositeActor.SonActors)
                    {
                        if (son == null || son.IsDead() || son.IsActorInvisiable)
                        {
                            continue;
                        }

                        distanceSquare = AIHelper.DistanceSquare(mRunningProperty.SelfActorPos, son.transform.position);

                        if (distanceSquare < shortest)
                        {
                            shortest      = distanceSquare;
                            oppositeActor = son;
                        }
                    }

                    return(oppositeActor);
                }
            }
        }
        //else if (InstanceManager.Instance.InstanceType == GameConst.WAR_TYPE_ARENA)
        //{
        //    if (mRunningProperty.SelfActor.ParentActor == null)
        //    {
        //        return null;
        //    }

        //    foreach (var item in ActorManager.Instance.ActorSet)
        //    {
        //        if(item.Value.IsActorInvisiable)
        //        {
        //            continue;
        //        }

        //        if (item.Value.UID != mRunningProperty.SelfActor.ParentActor.UID)
        //        {
        //            return item.Value;
        //        }
        //    }
        //}

        // 是玩家队友
        if (localPlayer != null && monster.Camp == localPlayer.Camp)
        {
            Dictionary <UnitID, Actor> monsters = ActorManager.Instance.MonsterSet;

            // 计算出最短距离
            foreach (var item in monsters)
            {
                if (item.Value == null)
                {
                    continue;
                }

                if (item.Value.IsDead() || (item.Value.gameObject.activeSelf == false))
                {
                    continue;
                }

                if (item.Value == mRunningProperty.SelfActor.ParentActor || item.Value.IsActorInvisiable)
                {
                    continue;
                }

                if (item.Value == mRunningProperty.SelfActor)
                {
                    continue;
                }

                if (item.Value.Camp == monster.Camp)
                {
                    continue;
                }

                if (mRunningProperty.SelfActor.ParentActor != null)
                {
                    if (item.Value.ParentActor == mRunningProperty.SelfActor.ParentActor)
                    {
                        continue;
                    }
                }

                float distanceSquare = AIHelper.DistanceSquare(mRunningProperty.SelfActorPos, item.Value.transform.position);
                if (distanceSquare < shortest)
                {
                    shortest    = distanceSquare;
                    targetActor = item.Value;
                }
            }

            if (InstanceManager.Instance.InstanceType == GameConst.WAR_TYPE_WILD)
            {
                if (localPlayer != null && localPlayer.WildState == Actor.EWildState.Kill)
                {
                    Dictionary <UnitID, Actor> players = ActorManager.Instance.PlayerSet;

                    // Linq
                    //monsters = monsters.Concat(players).ToDictionary(k => k.Key, v => v.Value);

                    // 计算出最短距离
                    foreach (var item in players)
                    {
                        if (item.Value == null)
                        {
                            continue;
                        }

                        if (item.Value.IsDead() || (item.Value.gameObject.activeSelf == false))
                        {
                            continue;
                        }

                        if (item.Value == mRunningProperty.SelfActor.ParentActor || item.Value.IsActorInvisiable)
                        {
                            continue;
                        }

                        if (mRunningProperty.SelfActor.ParentActor != null)
                        {
                            if (!mRunningProperty.SelfActor.ParentActor.CheckCanAttackOtherPlayer(item.Value))
                            {
                                continue;
                            }
                        }

                        float distanceSquare = AIHelper.DistanceSquare(mRunningProperty.SelfActorPos, item.Value.transform.position);
                        if (distanceSquare < shortest)
                        {
                            shortest    = distanceSquare;
                            targetActor = item.Value;
                        }
                    }
                }

                if (shortest > viewRange)
                {
                    targetActor = null;
                }
            }

            return(targetActor);
        }

        // 先检测当前目标有没有脱离视野范围
        if (mRunningProperty.TargetActor != null && !mRunningProperty.TargetActor.IsActorInvisiable)
        {
            float distance = AIHelper.DistanceSquare(mRunningProperty.TargetActor.transform.position, mRunningProperty.SelfActorPos);

            if (distance <= viewRange && !mRunningProperty.TargetActor.IsActorInvisiable)
            {
                return(mRunningProperty.TargetActor);
            }
        }

        targetActor = Game.GetInstance().GetLocalPlayer();

        if (targetActor != null)
        {
            shortest = AIHelper.DistanceSquare(targetActor.transform.position, mRunningProperty.SelfActorPos);
        }
        else
        {
            shortest = float.MaxValue;
        }

        // 检测召唤出来的怪物
        Dictionary <UnitID, Actor> summonMonsters = ActorManager.Instance.SummonMonsterSet;

        foreach (var item in summonMonsters)
        {
            Monster monster2 = item.Value as Monster;

            if (monster2 == null)
            {
                continue;
            }

            if (monster2.BeSummonedType == Monster.BeSummonType.BE_SUMMON_BY_MONSTER)
            {
                continue;
            }

            if (monster2.IsActorInvisiable)
            {
                continue;
            }

            float distance = AIHelper.DistanceSquare(item.Value.transform.position, mRunningProperty.SelfActorPos);

            if (distance > viewRange || distance > shortest)
            {
                continue;
            }

            shortest    = distance;
            targetActor = item.Value;
        }

        // 检测场景内的NPC
        var allNpc = NpcManager.Instance.AllNpc;

        foreach (var item in allNpc)
        {
            NpcPlayer npc = item.Value.BindActor as NpcPlayer;
            if (npc.NpcData.Relationship != Neptune.Relationship.FRIENDLY)
            {
                continue;
            }

            float distance = AIHelper.DistanceSquare(npc.transform.position, mRunningProperty.SelfActorPos);

            if (distance > viewRange || distance > shortest)
            {
                continue;
            }

            if (npc.IsActorInvisiable)
            {
                continue;
            }

            shortest    = distance;
            targetActor = npc;
        }

        if (shortest > viewRange)
        {
            targetActor = null;
        }

        return(targetActor);
    }
示例#54
0
        private void UpdateMonsterInfo(Monster Monster)
        {
            Visibility                = Visibility.Visible;
            MonsterName.Text          = Monster.Name;
            MonsterHealthBar.MaxSize  = Width * 0.7833333333333333;
            MonsterStaminaBar.MaxSize = Width - 72;

            // Update monster health and stamina
            UpdateHealthBar(MonsterHealthBar, Monster.Health, Monster.MaxHealth);
            UpdateHealthBar(MonsterStaminaBar, Monster.Stamina, Monster.MaxStamina);
            SetMonsterHealthBarText(Monster.Health, Monster.MaxHealth);
            SetMonsterStaminaText(Monster.Stamina, Monster.MaxStamina);
            DisplayCapturableIcon(Monster.Health, Monster.MaxHealth, Monster.CaptureThreshold);

            // Gets monster icon
            MonsterIcon.Source = GetMonsterIcon(Monster.Id);

            SwitchSizeBasedOnTarget();

            // Parts
            int index = 0;

            MonsterPartsContainer.Children.Clear();
            while (index < Monster.Parts.Count)
            {
                Part        mPart       = Monster.Parts[index];
                MonsterPart PartDisplay = new MonsterPart()
                {
                    Style = FindResource("OVERLAY_MONSTER_SUB_PART_STYLE") as Style
                };
                PartDisplay.SetContext(mPart, MonsterPartsContainer.ItemWidth);
                MonsterPartsContainer.Children.Add(PartDisplay);
                index++;
            }

            // Ailments
            index = 0;
            MonsterAilmentsContainer.Children.Clear();
            while (index < Monster.Ailments.Count)
            {
                Ailment        ailment        = Monster.Ailments[index];
                MonsterAilment AilmentDisplay = new MonsterAilment()
                {
                    Style = FindResource("OVERLAY_MONSTER_SUB_AILMENT_STYLE") as Style
                };
                AilmentDisplay.SetContext(ailment, MonsterAilmentsContainer.ItemWidth);
                MonsterAilmentsContainer.Children.Add(AilmentDisplay);
                index++;
            }

            // Enrage
            if (Monster.IsEnraged && !UserSettings.PlayerConfig.Overlay.MonstersComponent.HideHealthInformation)
            {
                ANIM_ENRAGEDICON.Begin(MonsterHealthBar, true);
                ANIM_ENRAGEDICON.Begin(HealthBossIcon, true);
                EnrageTimerText.Visibility = Visibility.Visible;
                EnrageTimerText.Text       = $"{Monster.EnrageTimerStatic - Monster.EnrageTimer:0}s";
            }

            // Set monster crown
            MonsterCrown.Source     = Monster.Crown == null ? null : (ImageSource)FindResource(Monster.Crown);
            MonsterCrown.Visibility = Monster.Crown == null ? Visibility.Collapsed : Visibility.Visible;
            Weaknesses.Children.Clear(); // Removes every weakness icon
            if (Monster.Weaknesses == null)
            {
                return;
            }
            index = 0;
            while (index < Monster.Weaknesses.Keys.Count)
            {
                string      Weakness = Monster.Weaknesses.Keys.ElementAt(index);
                ImageSource img      = FindResource(Weakness) as ImageSource;
                img?.Freeze();
                WeaknessDisplay MonsterWeaknessDisplay = new WeaknessDisplay
                {
                    Icon   = img,
                    Width  = 20,
                    Height = 20
                };
                Weaknesses.Children.Add(MonsterWeaknessDisplay);
                index++;
            }
            // Sometimes Alatreon's state changes before OnMonsterSpawn is dispatched
            if (Monster.GameId == 87)
            {
                OnAlatreonElementShift(this, EventArgs.Empty);
            }
        }
示例#55
0
        /// <summary>
        /// Constructor
        /// </summary>
        /// <param name="striker">Striker entity</param>
        /// <param name="Attacked">Attacked entity</param>
        /// <param name="item">Item used as a weapon. Use null for a hand attack</param>
        /// http://nwn2.wikia.com/wiki/Attack_sequence
        public Attack(Entity striker, Entity target, Item item)
        {
            Team team = GameScreen.Team;

            Time    = DateTime.Now;
            Striker = striker;
            Target  = target;
            Item    = item;

            if (striker == null || target == null)
            {
                return;
            }

            // Ranged attack ?
            DungeonLocation from = null;
            DungeonLocation to   = null;

            if (striker is Hero)
            {
                from = team.Location;
            }
            else
            {
                from = ((Monster)striker).Location;
            }

            if (target is Hero)
            {
                to = team.Location;
            }
            else
            {
                to = ((Monster)target).Location;
            }

            Range = (int)Math.Sqrt((from.Coordinate.Y - to.Coordinate.Y) * (from.Coordinate.Y - to.Coordinate.Y) +
                                   (from.Coordinate.X - to.Coordinate.X) * (from.Coordinate.X - to.Coordinate.X));

            // Attack roll
            int attackdie = Dice.GetD20(1);

            // Critical fail ?
            if (attackdie == 1)
            {
                attackdie = -100000;
            }

            // Critical Hit ?
            if (attackdie == 20)
            {
                attackdie = 100000;
            }


            // Base attack bonus
            int baseattackbonus = 0;
            int modifier        = 0;                            // modifier
            int sizemodifier    = 0;                            // Size modifier
            int rangepenality   = 0;                            // Range penality


            if (striker is Hero)
            {
                baseattackbonus = ((Hero)striker).BaseAttackBonus;
            }
            else if (striker is Monster)
            {
                Monster monster = striker as Monster;
                //sizemodifier = (int)monster.Size;
            }


            // Range penality
            if (RangedAttack)
            {
                modifier = striker.Dexterity.Modifier;

                //TODO : Add range penality
            }
            else
            {
                modifier = striker.Strength.Modifier;
            }

            // Attack bonus
            int attackbonus = baseattackbonus + modifier + sizemodifier + rangepenality;

            if (target.ArmorClass > attackdie + attackbonus)
            {
                return;
            }


            if (item != null)
            {
                Hit = item.Damage.Roll();
            }
            else
            {
                Dice dice = new Dice(1, 4, 0);
                Hit = dice.Roll();
            }

            if (IsAHit)
            {
                Target.Hit(this);
            }
        }
 public abstract Task Execute(Monster source, Monster target);
示例#57
0
    public void Flipped()
    {
        flippedMenu.SetActive(true);
        App.Controller.openMenuController.OpenMenu(flippedMenu);


        AncientOne ao = App.Model.ancientOneModel.ancientOne;

        menuTitle.text = ao.ancientOneName + " has Awoken!";
        if (ao.awakenText == "")
        {
            awakenEvent.SetActive(false);
        }
        else
        {
            awakenTitle.text     = ao.ancientOneName + " Awakens!";
            awakenEventText.text = ao.awakenText;
        }
        mysteryTitle.text      = ao.finalMysteryTitle;
        mysteryFlavorText.text = ao.finalMysteryFlavorText;
        mysteryText.text       = ao.finalMysteryText;
        infoTitle.text         = ao.flipInfoTitle;
        foreach (Transform child in infoTexts.transform)
        {
            Destroy(child.gameObject);
        }
        for (int i = 0; i < ao.flipTexts.Length; i++)
        {
            GameObject go = Instantiate(textBlock, infoTexts.transform);
            go.GetComponent <Text>().text = ao.flipTexts[i];
            GameObject reckoning = go.transform.GetChild(0).gameObject;
            if (i == ao.backReckoningTextIndex)
            {
                reckoning.SetActive(true);
            }
            else
            {
                reckoning.SetActive(false);
            }
        }

        Monster c = ao.cultist2;

        cultistToughness.text = "" + c.toughness;
        if (c.tests[0] == TestStat.None)
        {
            cultistTest1Type.sprite   = App.Model.gameSpritesModel.GetTestStatSprite(TestStat.None);
            cultistTest1Mod.text      = "";
            cultistHorror.text        = "";
            cultistDamage1Icon.sprite = App.Model.gameSpritesModel.GetTestStatSprite(TestStat.None);
        }
        else
        {
            cultistTest1Type.sprite = App.Model.gameSpritesModel.GetTestStatSprite(c.tests[0]);
            if (c.testMods[0] == 0)
            {
                cultistTest1Mod.text = "";
            }
            else
            {
                cultistTest1Mod.text = "" + c.testMods[0];
            }
            cultistHorror.text        = "" + c.horror;
            cultistDamage1Icon.sprite = App.Model.gameSpritesModel.sanitySprite;
        }
        if (c.tests[1] == TestStat.None)
        {
            cultistTest2Type.sprite   = App.Model.gameSpritesModel.GetTestStatSprite(TestStat.None);
            cultistTest2Mod.text      = "";
            cultistDamage.text        = "";
            cultistDamage2Icon.sprite = App.Model.gameSpritesModel.GetTestStatSprite(TestStat.None);
        }
        else
        {
            cultistTest2Type.sprite = App.Model.gameSpritesModel.GetTestStatSprite(c.tests[1]);
            if (c.testMods[1] == 0)
            {
                cultistTest2Mod.text = "";
            }
            else
            {
                cultistTest2Mod.text = "" + c.testMods[1];
            }
            cultistDamage.text        = "" + c.damage;
            cultistDamage2Icon.sprite = App.Model.gameSpritesModel.healthSprite;
        }
        cultistText.text = c.monsterText;
    }
示例#58
0
 public double CalcDirection(Monster sprite, Point p)
 {
     return(Global.GetDirectionByTan(p.X, p.Y, sprite.Coordinate.X, sprite.Coordinate.Y));
 }
示例#59
0
    private void PopulateData(Monster monster)
    {
        Transform nameText = Name.Find("Text");

        nameText.GetComponent <Text>().text = monster.Name;

        Transform typeText = Type.Find("Text");

        typeText.GetComponent <Text>().text = monster.type;

        //NOTE: Redo with stars
        Transform starLevel = StarLevel.Find("Text");

        starLevel.GetComponent <Text>().text = string.Format("{0}*'s", monster.star_level);

        ImgDisp.loadSpriteToObject(
            monster.image_base,
            ImageBase,
            string.Format(
                "{0}_{1}_b.png",
                monster.type,
                monster.Name
                )
            );

        ImgDisp.loadSpriteToObject(
            monster.image_awakened,
            ImageAwakened,
            string.Format(
                "{0}_{1}_a.png",
                monster.type,
                monster.Name
                )
            );

        Transform levelText = Level.Find("Value");

        levelText.GetComponent <Text>().text = string.Format("{0}", monster.level);

        Transform baseHPText = BaseHP.Find("Value");

        baseHPText.GetComponent <Text>().text = string.Format("{0}", monster.base_hp);

        Transform baseAttackText = BaseAttack.Find("Value");

        baseAttackText.GetComponent <Text>().text = string.Format("{0}", monster.base_attack);

        Transform baseSpeedText = BaseSpeed.Find("Value");

        baseSpeedText.GetComponent <Text>().text = string.Format("{0}", monster.base_speed);

        Transform baseDefenseText = BaseDefense.Find("Value");

        baseDefenseText.GetComponent <Text>().text = string.Format("{0}", monster.base_defense);

        Transform baseCritRateText = BaseCritRate.Find("Value");

        baseCritRateText.GetComponent <Text>().text = string.Format("{0}", monster.base_crit_rate);

        Transform baseCritDamageText = BaseCritDamage.Find("Value");

        baseCritDamageText.GetComponent <Text>().text = string.Format("{0}", monster.base_crit_damage);

        Transform baseResistanceText = BaseResistance.Find("Value");

        baseResistanceText.GetComponent <Text>().text = string.Format("{0}", monster.base_resistance);

        Transform baseAccuracyText = BaseAccuracy.Find("Value");

        baseAccuracyText.GetComponent <Text>().text = string.Format("{0}", monster.base_accuracy);
    }
示例#60
0
        public void monsterIsDeadTest()
        {
            Monster m1 = new Monster("slime");

            Assert.AreEqual(true, m1.isDead(0));
        }