public void Test2() { Drake a = new Drake(); string d = a.Display(); Assert.Equal("Kono Ahiru Da!", d); }
public void Test4() { IQuack a = new Drake(); string q = a.Quack(); Assert.Equal("Quack-Quack!", q); }
public void Test3() { IFly a = new Drake(); string f = a.Fly(); Assert.Equal("5 minutes, flight is fine.", f); }
public void serialize_a_unit() { Arena arena = new Arena(); Team team = new Team(arena, "blue", 125); Archer archer = new Archer(arena, team, 1); team.Units.Add(1, archer); team.Acount++; Balista balista = new Balista(arena, team, 2); team.Units.Add(2, balista); team.Bcount++; Catapult catapult = new Catapult(arena, team, 3); team.Units.Add(3, catapult); team.Ccount++; Drake drake = new Drake(arena, team, 4); team.Units.Add(4, drake); team.Dcount++; //Team result = new Team(token); //IEnumerable<Unit> units = result.GetUnits(); //Assert.That(units.Count(), Is.EqualTo(2)); //Assert.That(units.Any(u => u.Health == 20.0 && u.Speed == 20.0)); //Assert.That(units.Any(u => u.Health == 10.0 && u.Speed == 15.0)); //Assert.That(units.All(u => u.Team == result)); }
public void Test1() { Drake a = new Drake(); string s = Drake.Swim(); Assert.Equal("Water is acceptable.", s); }
protected override void OnTick() { if (m_Item.Deleted) { return; } Mobile spawn; switch (Utility.Random(8)) { default: case 0: spawn = new ElderGazer(); break; case 1: spawn = new Imp(); break; case 2: spawn = new OrcBrute(); break; case 3: spawn = new Phoenix(); break; case 4: spawn = new Quagmire(); break; case 5: spawn = new WhippingVine(); break; case 6: spawn = new Drake(); break; case 7: spawn = new VorpalBunny(); break; } spawn.MoveToWorld(m_Item.Location, m_Item.Map); m_Item.Delete(); }
private void StartGame(Drake drake) { if (Engine.IsDrakeLocked(drake)) { return; } Engine.PanelManager.ShowGamePanels(); Engine.TaskScheduler.CreateTask(() => { if (Engine.GameRunning) { TweenAlpha.Begin(FillerSprite, 1, 20 / 255f); } }, 1); foreach (var game in FindObjectsOfType <Game>()) { if (game.Drake == drake) { game.Sprite.enabled = game.SpriteGray.enabled = true; game.StartGame(); } else { game.Sprite.enabled = game.SpriteGray.enabled = false; game.StopGame(); } } Countdown(); }
public void deserialize_a_team() { Arena arena = new Arena(); Team sut = new Team(arena, "blue", 125); Archer archer = new Archer(arena, sut, 1); sut.Units.Add(1, archer); sut.Acount++; Balista balista = new Balista(arena, sut, 2); sut.Units.Add(2, balista); sut.Bcount++; Catapult catapult = new Catapult(arena, sut, 3); sut.Units.Add(3, catapult); sut.Ccount++; Drake drake = new Drake(arena, sut, 4); sut.Units.Add(4, drake); sut.Dcount++; string fileName = Path.GetTempFileName(); { JToken token = sut.Serialize(); using (FileStream fs = File.OpenWrite(fileName)) using (StreamWriter sw = new StreamWriter(fs)) using (JsonTextWriter jw = new JsonTextWriter(sw)) { token.WriteTo(jw); } } { using (FileStream fs = File.OpenRead(fileName)) using (StreamReader sr = new StreamReader(fs)) using (JsonTextReader jr = new JsonTextReader(sr)) { JToken token = JToken.ReadFrom(jr); Team team = new Team(arena, token); IEnumerable <Unit> units = team.GetUnits(); Assert.That(units.Count(), Is.EqualTo(sut.UnitCount)); Assert.That(units.Count(), Is.EqualTo(4)); Assert.That(units.Any(u => u.Life == 12.0 && u.Speed == 1.8 && u.Troop == "archer")); Assert.That(units.Any(u => u.Life == 25.0 && u.Speed == 0.70 && u.Troop == "balista")); Assert.That(units.Any(u => u.Life == 30.0 && u.Speed == 0.50 && u.Troop == "catapult")); Assert.That(units.Any(u => u.Life == 10 && u.Speed == 1.5 && u.Troop == "drake")); Assert.That(units.All(u => u.Team == team)); } } }
/// <summary> /// Releases the target and briefly disables chase phase. /// Does nothing if the target is not grabbed. /// </summary> private void ReleaseTarget() { if (grabbingTarget) { SoundLevel1.Instance.DrakeFree(); Drake drake = targets[index].GetComponent <Drake>(); if (drake != null) { drake.UngrabbedByHornet(); } grabbingTarget = false; chaseStartTime = Time.time + Random.Range(0.5f, 1.5f); } }
private static bool CheckDrakeLocked(Drake drake) { if (!Profile.Scores.ContainsKey(drake)) { return(true); } foreach (var game in FindObjectsOfType <Game>()) { if (game.Drake == drake) { return(Profile.Scores[drake] < game.PassTarget); } } throw new Exception(); }
public bool IsDrakeLocked(Drake drake) { switch (drake) { case Drake.Astarot: case Drake.Leviathan: case Drake.Ryuu: return(false); case Drake.Viper: return(CheckDrakeLocked(Drake.Ryuu)); case Drake.Volos: return(CheckDrakeLocked(Drake.Viper)); default: throw new Exception(); } }
public void serialize_an_arena() { Arena sut = new Arena(); Team team = sut.CreateTeam("blue"); Archer archer = new Archer(sut, team, 1); team.Units.Add(1, archer); team.Acount++; Balista balista = new Balista(sut, team, 2); team.Units.Add(2, balista); team.Bcount++; Catapult catapult = new Catapult(sut, team, 3); team.Units.Add(3, catapult); team.Ccount++; Drake drake = new Drake(sut, team, 4); team.Units.Add(4, drake); team.Dcount++; JToken jToken = sut.Serialize(); Arena result = new Arena(jToken); IEnumerable <Team> teams = result.GetTeams(); Assert.That(teams.Count(), Is.EqualTo(1)); //Assert.That(teams.Any(t => t.Name == "blue" && t.UnitCount == 4)); Assert.That(sut.TeamCount == result.TeamCount); //Assert.That( sut.Teams == result.Teams); //Assert.That(sut == result); }
public void serialize_a_team() { Arena arena = new Arena(); Team sut = arena.CreateTeam("blue"); Archer archer = new Archer(arena, sut, 1); sut.Units.Add(1, archer); sut.Acount++; Balista balista = new Balista(arena, sut, 2); sut.Units.Add(2, balista); sut.Bcount++; Catapult catapult = new Catapult(arena, sut, 3); sut.Units.Add(3, catapult); sut.Ccount++; Drake drake = new Drake(arena, sut, 4); sut.Units.Add(4, drake); sut.Dcount++; JToken jToken = sut.Serialize(); Team result = new Team(arena, jToken); IEnumerable <Unit> units = result.GetUnits(); Assert.That(units.Count(), Is.EqualTo(4)); Assert.That(units.Any(u => u.Life == 12.0 && u.Speed == 1.8 && u.Troop == "archer")); Assert.That(units.Any(u => u.Life == 25.0 && u.Speed == 0.70 && u.Troop == "balista")); Assert.That(units.Any(u => u.Life == 30.0 && u.Speed == 0.50 && u.Troop == "catapult")); Assert.That(units.Any(u => u.Life == 10 && u.Speed == 1.5 && u.Troop == "drake")); Assert.That(units.All(u => u.Team == result)); }
void OnTriggerEnter(Collider other) { if (!swapping) { DrakeScale drakeScale = other.GetComponent <DrakeScale>(); if (drakeScale != null && drakeScale.HasMoonPaint) { Drake drake = drakeScale.drakeRef; if (drake.LastTouchedStar == null) { // First star selected ! if (halo != null) { halo.SetON(true); } drake.LastTouchedStar = gameObject; } else { SwappableStar otherStar = drake.LastTouchedStar.GetComponent <SwappableStar>(); // If the star exist and is different if (otherStar != null && otherStar != this) { drake.LastTouchedStar = null; // Second star selected, swapping ! Swap(otherStar, true); SoundLevel2.Instance.SwapStar(); } } } } }
/// <summary> /// Starts grabbing the target and sets grabbingTarget to true. /// Does nothing if it already grabs a target. /// It may causes trouble to the target. /// It also sets a release time after which hornets will release their target. /// </summary> private void GrabTarget() { if (!grabbingTarget) { if (Level.Get.levelID == 1) { SoundLevel1.Instance.HornetOnHead(); } Drake drake = targets[index].GetComponent <Drake>(); if (drake != null) { drake.GrabbedByHornet(); willRelease = true; } Ladybird ladybird = targets[index].GetComponent <Ladybird>(); if (ladybird != null) { ladybird.GrabbedByHornet(); willRelease = false; } grabbingTarget = true; releaseTargetTime = Time.time + Random.Range(4f, 8f); } }
public Character GetEnemy(int id) { Character nextChar; switch (id) { //Low level case 100: nextChar = new Bat(); return(nextChar); case 101: nextChar = new Rat(); return(nextChar); case 102: nextChar = new Kobold(); return(nextChar); case 103: nextChar = new Slime(); return(nextChar); case 104: nextChar = new Farmer(); return(nextChar); case 105: nextChar = new Imp(); return(nextChar); case 106: nextChar = new Zombie(); return(nextChar); case 107: nextChar = new Phantom(); return(nextChar); case 108: nextChar = new Goblin(); return(nextChar); case 109: nextChar = new Witch(); return(nextChar); //Mid level case 110: nextChar = new Harpy(); return(nextChar); case 111: nextChar = new Elemental(); return(nextChar); case 112: nextChar = new Nymph(); return(nextChar); case 113: nextChar = new Vampire(); return(nextChar); case 114: nextChar = new Lamia(); return(nextChar); case 115: nextChar = new Qilin(); return(nextChar); case 116: nextChar = new Unicorn(); return(nextChar); case 117: nextChar = new Jinn(); return(nextChar); case 118: nextChar = new Xorn(); return(nextChar); case 119: nextChar = new Antlion(); return(nextChar); //High level case 120: nextChar = new Yeti(); return(nextChar); case 121: nextChar = new Orc(); return(nextChar); case 122: nextChar = new Minotaur(); return(nextChar); case 123: nextChar = new Troll(); return(nextChar); case 124: nextChar = new Cyclop(); return(nextChar); case 125: nextChar = new Drake(); return(nextChar); default: nextChar = new Slime(); return(nextChar); } }
public override void Damage(Mobile m) { base.Damage(m); if (m.Alive) { Item item = m.FindItemOnLayer(Layer.OuterTorso); if (item is GMRobe) { AOS.Damage(m, 0, 0, 0, 0, 0, 0); } else if (item is GMRobeExplosion) { AOS.Damage(m, 0, 0, 0, 0, 0, 0); m.PlaySound(Utility.RandomList(0x307, 0x308)); } else if (item is GMRobeHoly) { AOS.Damage(m, 0, 0, 0, 0, 0, 0); m.FixedParticles(0x375A, 1, 30, 9966, 88, 2, EffectLayer.Head); m.FixedParticles(0x37B9, 1, 30, 9502, 85, 3, EffectLayer.Head); m.FixedParticles(0x376A, 1, 31, 9961, 80, 0, EffectLayer.Waist); m.FixedParticles(0x37C4, 1, 31, 9502, 88, 2, EffectLayer.Waist); } else if (item is GMRobeTrailfire) { AOS.Damage(m, 0, 0, 0, 0, 0, 0); m.FixedParticles(0x3709, 10, 30, 5052, EffectLayer.LeftFoot); } else { // Crimson Meteor if (Utility.RandomDouble() < 0.005) { Ability.CrimsonMeteor(m, 10); AOS.Damage(m, 0, 0, 0, 0, 0, 0); } // Wind if (Utility.RandomDouble() < 0.25) { m.PlaySound(Utility.RandomList(0x014, 0x15, 0x016, 0x5C7)); AOS.Damage(m, 0, 0, 0, 0, 0, 0); } // Wind if (Utility.RandomDouble() < 0.15) { m.PlaySound(Utility.RandomList(0x014, 0x15, 0x016, 0x5C7)); AOS.Damage(m, 0, 0, 0, 0, 0, 0); } // Wind if (Utility.RandomDouble() < 0.08) { m.PlaySound(Utility.RandomList(0x014, 0x15, 0x016, 0x5C7)); AOS.Damage(m, 0, 0, 0, 0, 0, 0); } // Wind if (Utility.RandomDouble() < 0.05) { m.PlaySound(Utility.RandomList(0x014, 0x15, 0x016, 0x5C7)); AOS.Damage(m, 0, 0, 0, 0, 0, 0); } // Tamable Encounter 1 if (Utility.RandomDouble() < 0.002) { if (m.Map == Map.Malas) { int x1 = m.X + 12; int y1 = m.Y + 12; int z1 = Map.Malas.GetAverageZ(x1, y1); if (Map.Malas.CanSpawnMobile(x1, y1, z1)) { BaseCreature tameable; switch (Utility.Random(2)) { default: case 0: tameable = new Drake(); break; case 1: tameable = new Dragon(); break; } tameable.MoveToWorld(new Point3D(x1, y1, z1), Map.Malas); tameable.Combatant = m; m.PlaySound(0x656); // risingColossus AOS.Damage(m, 0, 0, 0, 0, 0, 0); Timer.DelayCall(TimeSpan.FromMinutes(20.0), new TimerStateCallback(DeleteTameable), tameable); } } } // Tamable Encounter 2 if (Utility.RandomDouble() < 0.002) { if (m.Map == Map.Malas) { int x2 = m.X - 12; int y2 = m.Y - 12; int z2 = Map.Malas.GetAverageZ(x2, y2); if (Map.Malas.CanSpawnMobile(x2, y2, z2)) { BaseCreature tameable; switch (Utility.Random(2)) { default: case 0: tameable = new Drake(); break; case 1: tameable = new Dragon(); break; } tameable.MoveToWorld(new Point3D(x2, y2, z2), Map.Malas); tameable.Combatant = m; m.PlaySound(0x656); // risingColossus AOS.Damage(m, 0, 0, 0, 0, 0, 0); Timer.DelayCall(TimeSpan.FromMinutes(20.0), new TimerStateCallback(DeleteTameable), tameable); } } } } } }
// // Methods // void Awake() { globalInstance = this; }
public override void OnTrigger(object activator, Mobile m) { if (m == null || this.Word == null || (this.RequireIdentification && !this.m_Identified)) { return; } if (DateTime.Now < this.m_EndTime) { return; } string msgstr = "Activating the power of " + this.Word; // assign powers to certain words switch (this.Word) { case "Shoda": m.AddStatMod(new StatMod(StatType.Int, "Shoda", 20, this.Duration)); m.SendMessage("Your mind expands!"); break; case "Malik": m.AddStatMod(new StatMod(StatType.Str, "Malik", 20, this.Duration)); m.SendMessage("Your strength surges!"); break; case "Lepto": m.AddStatMod(new StatMod(StatType.Dex, "Lepto", 20, this.Duration)); m.SendMessage("You are more nimble!"); break; case "Velas": Timer.DelayCall(TimeSpan.Zero, new TimerStateCallback(Hide_Callback), new object[] { m }); m.SendMessage("You disappear!"); break; case "Tarda": m.AddSkillMod(new TimedSkillMod(SkillName.Tactics, true, 20, this.Duration)); m.SendMessage("You are more skillful warrior!"); break; case "Marda": m.AddSkillMod(new TimedSkillMod(SkillName.Magery, true, 20, this.Duration)); m.SendMessage("You are more skillful mage!"); break; case "Vas Malik": m.AddStatMod(new StatMod(StatType.Str, "Vas Malik", 40, this.Duration)); m.SendMessage("You are exceptionally strong!"); break; case "Nartor": BaseCreature b = new Drake(); b.MoveToWorld(m.Location, m.Map); b.Owners.Add(m); b.SetControlMaster(m); if (b.Controlled) { m.SendMessage("You master the beast!"); } break; case "Santor": b = new Horse(); b.MoveToWorld(m.Location, m.Map); b.Owners.Add(m); b.SetControlMaster(m); if (b.Controlled) { m.SendMessage("You master the beast!"); } break; default: m.SendMessage("There is no effect."); break; } // display activation effects Effects.SendLocationParticles(EffectItem.Create(m.Location, m.Map, EffectItem.DefaultDuration), 0x3728, 8, 20, 5042); Effects.PlaySound(m, m.Map, 0x201); // display a message over the item it was attached to if (this.AttachedTo is Item) { ((Item)this.AttachedTo).PublicOverheadMessage(MessageType.Regular, 0x3B2, true, msgstr); } this.Charges--; // remove the attachment after the charges run out if (this.Charges == 0) { this.Delete(); } else { this.m_EndTime = DateTime.Now + this.Refractory; } }
public override void IncreaseTier() { base.IncreaseTier(); List <object> list = new List <object>(); BaseCreature c; // haven't got a clue if levels are OSI switch (this.Tier) { case 1: c = new Crane(); c.MoveToWorld(new Point3D(4500, 1382, 23), this.Map); c.Blessed = true; c.Tamable = false; list.Add(c); break; case 2: c = new DireWolf(); c.MoveToWorld(new Point3D(4494, 1370, 23), this.Map); c.Blessed = true; c.Tamable = false; list.Add(c); c = new DireWolf(); c.MoveToWorld(new Point3D(4494, 1360, 23), this.Map); c.Blessed = true; c.Tamable = false; list.Add(c); c = new WhiteWolf(); c.MoveToWorld(new Point3D(4491, 1366, 23), this.Map); c.Blessed = true; c.Tamable = false; list.Add(c); c = new WhiteWolf(); c.MoveToWorld(new Point3D(4497, 1366, 23), this.Map); c.Blessed = true; c.Tamable = false; list.Add(c); c = new GreyWolf(); c.MoveToWorld(new Point3D(4497, 1366, 23), this.Map); c.Blessed = true; c.Tamable = false; list.Add(c); break; case 3: c = new Quagmire(); c.MoveToWorld(new Point3D(4483, 1392, 23), this.Map); c.Blessed = true; c.Tamable = false; list.Add(c); c = new BogThing(); c.MoveToWorld(new Point3D(4486, 1385, 23), this.Map); c.Blessed = true; c.Tamable = false; list.Add(c); c = new PlagueBeast(); c.MoveToWorld(new Point3D(4486, 1379, 23), this.Map); c.Blessed = true; c.Tamable = false; list.Add(c); break; case 4: c = new PolarBear(); c.MoveToWorld(new Point3D(4513, 1395, 23), this.Map); c.Blessed = true; c.Tamable = false; list.Add(c); c = new PolarBear(); c.MoveToWorld(new Point3D(4508, 1393, 23), this.Map); c.Blessed = true; c.Tamable = false; list.Add(c); break; case 5: c = new Yamandon(); c.MoveToWorld(new Point3D(4498, 1393, 23), this.Map); c.Blessed = true; c.Tamable = false; list.Add(c); break; case 6: c = new Changeling(); c.MoveToWorld(new Point3D(4518, 1358, 23), this.Map); c.Blessed = true; c.Tamable = false; list.Add(c); break; case 7: c = new Wyvern(); c.MoveToWorld(new Point3D(4512, 1381, 23), this.Map); c.Blessed = true; c.Tamable = false; list.Add(c); break; case 8: c = new Dragon(); c.MoveToWorld(new Point3D(4511, 1372, 23), this.Map); c.Blessed = true; c.Tamable = false; list.Add(c); c = new Drake(); c.MoveToWorld(new Point3D(4516, 1371, 23), this.Map); c.Blessed = true; c.Tamable = false; list.Add(c); break; case 9: c = new Reptalon(); c.MoveToWorld(new Point3D(4530, 1387, 23), this.Map); c.Blessed = true; c.Tamable = false; list.Add(c); break; case 10: c = new SilverSteed(); c.MoveToWorld(new Point3D(4506, 1358, 23), this.Map); c.Blessed = true; c.Tamable = false; list.Add(c); /* * c = new Sphynx(); * c.MoveToWorld( new Point3D( 4506, 1358, 23 ), Map ); * c.Blessed = true; * c.Tamable = false; * list.Add( c );*/ break; } if (list.Count > 0) { this.Tiers.Add(list); } }
public void CreateEnemies() { Random rnd = new Random(); int enemiesCount = rnd.Next(2, 7); int meleCount = rnd.Next(0, enemiesCount + 1); int rangeCount = enemiesCount - meleCount; int possitionCounter = 0; for (int i = 0; i < rangeCount; i++) { int rangeType = rnd.Next(0, 3); IEnemy enemy = new Drake("Drake", 50, 27, 6, Pictures.Drake); for (int k = 0; k < rangeType; k++) { switch (k) { case 0: enemy = new Goblin("Goblin", 40, 23, 4, Pictures.Goblin); break; case 1: enemy = new Shade("Shade", 45, 25, 5, Pictures.Shade); break; case 2: enemy = new Drake("Drake", 50, 27, 6, Pictures.Drake); break; } } enemy.Position = this.enemiesPossitions[possitionCounter]; this.EnemyList.Add(enemy); possitionCounter++; } for (int i = 0; i < meleCount; i++) { int meleType = rnd.Next(0, 3); IEnemy enemy = new Golem("Golem", 60, 24, 7, Pictures.Golem); for (int k = 0; k < meleType; k++) { switch (k) { case 0: enemy = new Skeleton("Skeleton", 45, 20, 5, Pictures.Skeleton); break; case 1: enemy = new Ork("Ork", 55, 22, 6, Pictures.Ork); break; case 2: enemy = new Golem("Golem", 60, 24, 7, Pictures.Golem); break; } } enemy.Position = this.enemiesPossitions[possitionCounter]; this.EnemyList.Add(enemy); possitionCounter++; } }