Example #1
0
        public Level(IntVec startPoint, Tile[,] tiles, GridBoundList<IEnvironmentObject> environment, GridBoundList<IInteractable> interact, GridBoundList<ILightSource> light, GridBoundList<GameCharacter> characterEntities, int dungeonLevel)
        {
            this.tiles = tiles;
            this.startPoint = startPoint;
            this.Environment = environment;
            this.InteractableEnvironment = interact;
            this.CharacterEntities = characterEntities;
            this.LightSources = light;
            this.DroppedItems = new GridBoundList<Item>();
            this.DungeonLevel = dungeonLevel;
            calculateTiles();
            needToCache = true;
            cachedSolid = new bool[tiles.GetLength(0), tiles.GetLength(1)];

            a = GetStartPoint();
            b = findRandomOpenPosition();
            path = AStar.getPathBetween(this, a, b);
            moveset = AStar.getPossiblePositionsFrom(this, a, 15,false,false);

            for (int i = 0; i < 28; i++)
            {
                //Item item = Item.randomItem(10, 10);

                //Engine.Engine.Log(string.Format("Item Generated: {0}", item.Name));

                //DroppedItems.Add(item, findRandomOpenPosition());
            }
        }
Example #2
0
 public override void removeCastingSquares(IntVec cursorPosition)
 {
     for (int i = 0; i < castSquares.Length; i++)
     {
         castSquares[i] = new IntVec(0, 0);
     }
 }
Example #3
0
 public override IntVec[] viewCastRange(Level level, IntVec start)
 {
     List<IntVec> lines = new List<IntVec>();
     lines.AddRange(AStar.getTargetLine(level, start, new IntVec(start.X-radius,start.Y), false));
     lines.AddRange(AStar.getTargetLine(level, start, new IntVec(start.X+radius,start.Y), false));
     lines.AddRange(AStar.getTargetLine(level, start, new IntVec(start.X,start.Y-radius), false));
     lines.AddRange(AStar.getTargetLine(level, start, new IntVec(start.X,start.Y+radius), false));
     radiusSquares = lines.ToArray();
     return radiusSquares;
 }
Example #4
0
 protected override void finishCast(int damage, Mapping.Level mapLevel, HeroClasses.Hero hero)
 {
     for (int i = 0; i < castSquares.Length; i++)
     {
         GameCharacter test = (GameCharacter)mapLevel.CharacterEntities.FindEntity(castSquares[i]);
         if (test != null)
         {
             test.TakeDamage(damage, hero);
         }
         castSquares[i] = new IntVec(0, 0);
     }
 }
Example #5
0
 public override void finishCastandDealDamage(int heroLevel, int heroDamage, Mapping.Level mapLevel, HeroClasses.Hero hero)
 {
     for (int i = 0; i < castSquares.Length; i++)
     {
         if (mapLevel.Move(hero, castSquares[0], true))
         {
             Audio.playSound("Jump");
             cooldown = abilityCooldown;
             wasJustCast = true;
         }
         castSquares[i] = new IntVec(0, 0);
     }
 }
Example #6
0
 public Fireball()
 {
     name = "Fireball";
     description = "The mage strikes an enemy from a \ndistance with fire.";
     castSquares = new IntVec[1];
     for (int i = 0; i < castSquares.Length; i++)
     {
         castSquares[i] = new IntVec(0, 0);
     }
     baseDamage = 7;
     radius = 3;
     abilityCooldown = 5;
     abilityIndex = 10;
 }
Example #7
0
 public Eviscerate()
 {
     name = "Eviscerate";
     description = "The duelist strikes a single target \nthree times.";
     castSquares = new IntVec[1];
     for (int i = 0; i < castSquares.Length; i++)
     {
         castSquares[i] = new IntVec(0, 0);
     }
     baseDamage = 0;
     radius = 1;
     abilityCooldown = 4;
     abilityIndex = 23;
 }
Example #8
0
File: Mug.cs Project: JonECG/Brogue
 public Mug()
 {
     name = "Mug";
     description = "The rogue strikes the enemy chosen, \nand obtains a random item.";
     castSquares = new IntVec[1];
     for (int i = 0; i < castSquares.Length; i++)
     {
         castSquares[i] = new IntVec(0, 0);
     }
     baseDamage = 6;
     radius = 1;
     abilityCooldown = 6;
     abilityIndex = 20;
 }
Example #9
0
 public Vault()
 {
     name = "Vault";
     description = "The marksman leaps to the \nselected position.";
     castSquares = new IntVec[1];
     for (int i = 0; i < castSquares.Length; i++)
     {
         castSquares[i] = new IntVec(0, 0);
     }
     baseDamage = 0;
     radius = 3;
     abilityCooldown = 5;
     abilityIndex = 28;
 }
Example #10
0
 public ArcaneBarrage()
 {
     name = "Arcane Barrage";
     description = "The spellblade fires a barrage \nof arcane energy at all of the \nselected enemies.";
     castSquares = new IntVec[5];
     for (int i = 0; i < castSquares.Length; i++)
     {
         castSquares[i] = new IntVec(0, 0);
     }
     baseDamage = 5;
     radius = 5;
     abilityCooldown = 12;
     abilityIndex = 19;
 }
Example #11
0
 public SteadyShot()
 {
     name = "Steady Shot";
     description = "The ranger lines up the perfect \nshot on the selected target.";
     castSquares = new IntVec[1];
     for (int i = 0; i < castSquares.Length; i++)
     {
         castSquares[i] = new IntVec(0, 0);
     }
     baseDamage = 6;
     radius = 4;
     abilityCooldown = 5;
     abilityIndex = 26;
 }
Example #12
0
 public Execute()
 {
     name = "Execute";
     description = "The warrior strikes the enemy \nchosen. If the enemy is killed, \nthis ability's cooldown is reset.";
     castSquares = new IntVec[1];
     for (int i = 0; i < castSquares.Length; i++)
     {
         castSquares[i] = new IntVec(0, 0);
     }
     baseDamage = 6;
     radius = 1;
     abilityCooldown = 8;
     abilityIndex = 4;
 }
Example #13
0
 protected override void finishCast(int damage, Mapping.Level mapLevel, HeroClasses.Hero hero)
 {
     for (int i = 0; i < castSquares.Length; i++)
     {
         GameCharacter test = (GameCharacter)mapLevel.CharacterEntities.FindEntity(castSquares[i]);
         if (test != null)
         {
             Audio.playSound("HammerSmash");
             Engine.Engine.AddVisualAttack(test, "Hero/ShieldBash", .25f, 1.0f, .03f);
             test.TakeDamage(damage, hero);
         }
         castSquares[i] = new IntVec(0, 0);
     }
 }
Example #14
0
        public void UpdateView(IntVec position)
        {
            active.X = position.X - ViewWidth / 2;
            active.Y = position.Y - ViewHeight / 2;

            for (int x = 0; x < ViewWidth; x++)
            {
                for (int y = 0; y < ViewHeight; y++)
                {
                    if (x + active.X >= 0 && y + active.Y >= 0 && x + active.X < detected.GetLength(0) && y + active.Y < detected.GetLength(1))
                    detected[x + active.X, y + active.Y] = true;
                }
            }
        }
Example #15
0
 public Assassinate()
 {
     name = "Assassinate";
     description = "The assassin strikes his opponent \nwith great precision";
     castSquares = new IntVec[1];
     for (int i = 0; i < castSquares.Length; i++)
     {
         castSquares[i] = new IntVec(0, 0);
     }
     baseDamage = 7;
     radius = 2;
     abilityCooldown = 12;
     abilityIndex = 24;
 }
Example #16
0
 protected override void finishCast(int damage, Mapping.Level mapLevel, HeroClasses.Hero hero)
 {
     for (int i = 0; i < castSquares.Length; i++)
     {
         GameCharacter test = (GameCharacter)mapLevel.CharacterEntities.FindEntity(castSquares[i]);
         if (test != null)
         {
             Engine.Engine.AddVisualAttack(test, "Hero/Execute", .5f, 1.5f, .05f);
             test.TakeDamage(damage, hero);
             cooldown = getCooldown(test);
         }
         castSquares[i] = new IntVec(0, 0);
     }
 }
Example #17
0
 public SoulSiphon()
 {
     name = "Soul Siphon";
     description = "The mage deals damage to the enemy \nand heals for 100% of the damage \ndealt.";
     castSquares = new IntVec[1];
     for (int i = 0; i < castSquares.Length; i++)
     {
         castSquares[i] = new IntVec(0, 0);
     }
     baseDamage = 6;
     radius = 3;
     abilityCooldown = 10;
     abilityIndex = 17;
 }
Example #18
0
 public ShieldBash()
 {
     name = "Shield Bash";
     description = "The sentinel strikes enemies with \nhis shield.";
     castSquares = new IntVec[1];
     for (int i = 0; i < castSquares.Length; i++)
     {
         castSquares[i] = new IntVec(0, 0);
     }
     baseDamage = 5;
     radius = 1;
     abilityCooldown = 3;
     abilityIndex = 6;
 }
Example #19
0
 public Blink()
 {
     name = "Blink";
     description = "The mage teleports to the selected \nposition.";
     castSquares = new IntVec[1];
     for (int i = 0; i < castSquares.Length; i++)
     {
         castSquares[i] = new IntVec(0, 0);
     }
     baseDamage = 0;
     radius = 2;
     abilityCooldown = 2;
     abilityIndex = 11;
 }
Example #20
0
 public DoubleSlash()
 {
     name = "Double Slash";
     description = "The warrior strikes a single target \nto deal double damage.";
     castSquares = new IntVec[1];
     for (int i = 0; i < castSquares.Length; i++)
     {
         castSquares[i] = new IntVec(0, 0);
     }
     baseDamage = 0;
     radius = 1;
     abilityCooldown = 6;
     abilityIndex = 3;
 }
Example #21
0
 public WhirlwindSlash()
 {
     name = "Whirlwind Slash";
     description = "The warrior swings his blade in a \ncircle sending tornadoes \nspiraling towards his foes.";
     radius = 1;
     isActuallyFilled = false;
     castSquares = new IntVec[12];
     baseDamage = 3;
     abilityCooldown = 7;
     for (int i = 0; i < castSquares.Length; i++)
     {
         castSquares[i] = new IntVec(0, 0);
     }
     abilityIndex = 1;
 }
Example #22
0
 public TimeStop()
 {
     name = "Time Stop";
     description = "The spellweaver stops time for the \nenemies around him.";
     radius = 4;
     isActuallyFilled = false;
     castSquares = new IntVec[40];
     baseDamage = 0;
     abilityCooldown = 20;
     for (int i = 0; i < castSquares.Length; i++)
     {
         castSquares[i] = new IntVec(0, 0);
     }
     abilityIndex = 14;
 }
Example #23
0
 public Volley()
 {
     name = "Volley";
     description = "The ranger fires a hail of arrows \nat the selected location.";
     castSquares = new IntVec[5];
     damageRadius = 1;
     for (int i = 0; i < castSquares.Length; i++)
     {
         castSquares[i] = new IntVec(0, 0);
     }
     baseDamage = 3;
     radius = 3;
     abilityCooldown = 4;
     abilityIndex = 27;
 }
Example #24
0
 protected override void finishCast(int damage, Mapping.Level mapLevel, HeroClasses.Hero hero)
 {
     for (int i = 0; i < castSquares.Length; i++)
     {
         GameCharacter test = (GameCharacter)mapLevel.CharacterEntities.FindEntity(castSquares[i]);
         if (test != null)
         {
             Audio.playSound("Arcane");
             Engine.Engine.AddVisualAttack(hero, test, "Hero/Overload", 1.0f, 1.0f, 0);
             test.DealElementalDamage(Enums.ElementAttributes.Arcane, 7, HeroClasses.Hero.level/2);
             test.TakeDamage(damage, hero);
         }
         castSquares[i] = new IntVec(0, 0);
     }
 }
Example #25
0
 public Slam()
 {
     name = "Slam";
     description = "The brawler slams the ground \nhitting enemies within a line.";
     radius = 4;
     isActuallyFilled = false;
     castSquares = new IntVec[16];
     baseDamage = 5;
     abilityCooldown = 10;
     for (int i = 0; i < castSquares.Length; i++)
     {
         castSquares[i] = new IntVec(0, 0);
     }
     abilityIndex = 2;
 }
Example #26
0
 public override void addCastingSquares(IntVec cursorPosition)
 {
     if (turnCount == 0)
     {
         turnCount = numTicks;
     }
     if ((castSquares[0].X == 0 && castSquares[0].Y == 0))
     {
         castSquares = radiusSquares;
     }
     else
     {
         isActuallyFilled = true;
     }
 }
Example #27
0
 protected override void finishCast(int damage, Mapping.Level mapLevel, HeroClasses.Hero hero)
 {
     for (int i = 0; i < castSquares.Length; i++)
     {
         GameCharacter test = (GameCharacter)mapLevel.CharacterEntities.FindEntity(castSquares[i]);
         if (test != null)
         {
             Engine.Engine.AddVisualAttack(test, "Hero/DoubleSlash", .25f, 2.0f, .15f);
             Audio.playSound("Slash", .25f);
             test.TakeDamage(damage, hero);
             if (mapLevel.CharacterEntities.FindPosition(test) != null )
                 test.TakeDamage(damage, hero);
         }
         castSquares[i] = new IntVec(0, 0);
     }
 }
Example #28
0
 public override void finishCastandDealDamage(int heroLevel, int heroDamage, Level mapLevel, HeroClasses.Hero hero)
 {
     int damage = calculateDamage(heroLevel, heroDamage);
     cooldown = abilityCooldown;
     wasJustCast = true;
     for (int i = 0; i < castSquares.Length; i++)
     {
         GameCharacter enemy = (GameCharacter)mapLevel.CharacterEntities.FindEntity(castSquares[i]);
         if (enemy != null)
         {
             drawVisualEffect(hero, enemy);
             enemy.DealElementalDamage(Enums.ElementAttributes.Ice, 7);
         }
         castSquares[i] = new IntVec(0, 0);
     }
     isActuallyFilled = false;
 }
Example #29
0
 public override void finishCastandDealDamage(int heroLevel, int heroDamage, Level mapLevel, HeroClasses.Hero hero)
 {
     int damage = calculateDamage(heroLevel, heroDamage);
     cooldown = abilityCooldown;
     wasJustCast = true;
     for (int i = 0; i < castSquares.Length; i++)
     {
         Audio.playSound("HammerSmash");
         Engine.Engine.AddVisualAttack(castSquares[i], "Hero/hammerSmash", .5f, 1.0f, .05f);
         GameCharacter enemy = (GameCharacter)mapLevel.CharacterEntities.FindEntity(castSquares[i]);
         if (enemy != null)
         {
             enemy.TakeDamage(damage, hero);
         }
         castSquares[i] = new IntVec(0, 0);
     }
     isActuallyFilled = false;
 }
Example #30
0
 public ArcaneOverload()
 {
     name = "Arcane Overload";
     description = "The spellblade overloads with \narcane energy, sending out \npulses of arcane damage.";
     radius = 3;
     isActuallyFilled = false;
     castSquares = new IntVec[60];
     baseDamage = 10;
     dotUsed = false;
     wasJustCast = false;
     abilityCooldown = 10;
     numTicks = 4;
     for (int i = 0; i < castSquares.Length; i++)
     {
         castSquares[i] = new IntVec(0,0);
     }
     abilityIndex = 18;
 }
Example #31
0
 public NodeMapper(IntVec origin, IEnumerable <IntVec> list)
 {
     _origin = origin;
     _shifts = new List <IntVec>(list);
     _calculateFinalPoints();
 }
 /*
  * 进行干员部署的设置
  */
 public void deploy(IntVec position, int rotation)
 {
     this.nodePosition      = position;
     this.nodeMapper.rotate = rotation;
     this._isOnStage        = true;
 }
Example #33
0
 internal bool isFree(IntVec pos)
 {
     return(floorPlan[pos.X, pos.Y]);
 }
Example #34
0
 public override IntVec[] viewCastRange(Level level, IntVec start)
 {
     radiusSquares = AStar.getPossiblePositionsFrom(level, start, radius, AStar.CharacterTargeting.PASS_THROUGH, false);
     return(radiusSquares);
 }
Example #35
0
 public abstract void drawVisualEffect(IntVec castEnemy);
Example #36
0
 public void Add(T t, IntVec position)
 {
     list.Add(Tuple.Create(t, new IntVec(position)));
 }
Example #37
0
        public T FindEntity(IntVec position)
        {
            Tuple <T, IntVec> tup = getTupleByPosition(position);

            return((tup != null) ? tup.Item1 : default(T));
        }
Example #38
0
 public NodeMapper()
 {
     _origin = new IntVec(0, 0);
     _shifts = new List <IntVec>();
     _calculateFinalPoints();
 }
Example #39
0
 public NodeMapper(IntVec origin)
 {
     _origin = origin;
     _shifts = new List <IntVec>();
     _calculateFinalPoints();
 }
Example #40
0
 public bool setUnfree(IntVec pos)
 {
     return(setUnfree(pos.X, pos.Y));
 }
Example #41
0
        private void damageEnemyIfInRange(IntVec[] hitBox, Level mapLevel, GameCharacter enemy, Weapon weapon, bool playAttack)
        {
            bool found = false;

            if (weapon != null)
            {
                string[] name = weapon.Name.Split();
                for (int i = 0; i < hitBox.Length && !found; i++)
                {
                    IntVec test = mapLevel.CharacterEntities.FindPosition(enemy);
                    if (hitBox[i].Equals(mapLevel.CharacterEntities.FindPosition(enemy)))
                    {
                        int weaponDamage = weapon.Damage + damageBoost + currentlyEquippedItems.getAccessoryDamageIncrease();
                        weaponDamage = (weaponDamage < 1) ? 1 : weaponDamage;
                        found        = true;
                        int damage = (!visible) ? (int)(1.5 * (weaponDamage)) : weaponDamage;
                        if (playAttack)
                        {
                            if (weapon.IsLegendary)
                            {
                                if (name[0] == "Blade" || name[0] == "Executioner" || name[0] == "Bloodthirster" || name[0] == "Pale" || name[0] == "Anarchy" || name[0] == "Judgement")
                                {
                                    Engine.Engine.AddVisualAttack(enemy, "Hero/LegendarySwordSlash", .25f, 2.0f, .15f);
                                    Audio.playSound("swordAttack");
                                }
                                else if (name[0] == "Kris")
                                {
                                    Engine.Engine.AddVisualAttack(enemy, "Hero/LegendaryDaggerSlash", .25f, 2.0f, .15f);
                                    Audio.playSound("DaggerStab");
                                }
                                else if (name[0] == "The")
                                {
                                    Engine.Engine.AddVisualAttack(enemy, "Hero/LegendaryClawSlash", .25f, 2.0f, .15f);
                                    Audio.playSound("swordAttack");
                                }
                                else if (name[0] == "40k")
                                {
                                    Audio.playSound("HammerSmash");
                                    Engine.Engine.AddVisualAttack(enemy, "Hero/LegendaryHammerSmash", .25f, 2.0f, .15f);
                                }
                                else if (name[0] == "Condemned" || name[0] == "Retribution")
                                {
                                    Audio.playSound("ArrowShot");
                                    Engine.Engine.AddVisualAttack(this, enemy, "Enemies/Attacks/Arrow", .25f, 1.0f, .15f);
                                }
                                else if (name[0] == "Kunai" || name[0] == "Heart")
                                {
                                    Engine.Engine.AddVisualAttack(this, enemy, weapon.GetTexture());
                                }
                                else if (name[0] == "Ebony" || name[0] == "Ivory")
                                {
                                    Audio.playSound("Gunshot", .5f);
                                    Engine.Engine.AddVisualAttack(this, enemy, "Hero/Bullet", .5f, .5f, 0);
                                }
                                else if (name[0] == "Bloodwing")
                                {
                                    Audio.playSound("SniperShot");
                                    Engine.Engine.AddVisualAttack(this, enemy, "Hero/Bullet", .5f, .5f, 0);
                                }
                                else
                                {
                                    Engine.Engine.AddVisualAttack(this, enemy, "Hero/MageAttack", .5f, 1.0f, .03f);
                                }
                            }
                            else if (!checkForWeaponType(0, enemy, name, weapon))
                            {
                                checkForWeaponType(1, enemy, name, weapon);
                            }
                            if (Element != null)
                            {
                                for (int j = 0; j < Element.Count; j++)
                                {
                                    switch (Element[j])
                                    {
                                    case ElementAttributes.Fire:
                                        enemy.DealElementalDamage(Element[j], 5, level / 2);
                                        break;

                                    case ElementAttributes.Ice:
                                        enemy.DealElementalDamage(Element[j], 3);
                                        break;

                                    case ElementAttributes.Lighting:
                                        enemy.DealElementalDamage(Element[j], 1, (level));
                                        break;

                                    case ElementAttributes.Arcane:
                                        enemy.DealElementalDamage(Element[j], 7, level / 2);
                                        break;
                                    }
                                }
                            }
                        }
                        for (int j = 0; j < abilities.Length; j++)
                        {
                            if (abilities[j] != null && abilities[j].type == AbilityTypes.Toggle)
                            {
                                ToggleAbility toggle = (ToggleAbility)abilities[j];
                                if (toggle.isActive)
                                {
                                    toggle.toggledAttackEffects(this);
                                }
                            }
                        }
                        enemy.TakeDamage(damage, this);
                        invisibilityTurnCount = 0;
                        turnOver = true;
                    }
                }
            }
        }
Example #42
0
                public int getLargestOpening()
                {
                    int    currentOpening = 0;
                    int    largest        = 0;
                    IntVec pos;

                    for (int i = 0; i < dimensions.Height; i++)
                    {
                        pos = new IntVec(dimensions.X - 1, dimensions.Y + i);
                        if (floorPlan[pos.X, pos.Y])
                        {
                            currentOpening++;
                        }
                        else
                        {
                            currentOpening = 0;
                        }
                        largest = Math.Max(largest, currentOpening);
                    }

                    for (int i = 0; i < dimensions.Width; i++)
                    {
                        pos = new IntVec(dimensions.X + i, dimensions.Y - 1);
                        if (floorPlan[pos.X, pos.Y])
                        {
                            currentOpening++;
                        }
                        else
                        {
                            currentOpening = 0;
                        }
                        largest = Math.Max(largest, currentOpening);
                    }

                    for (int i = 0; i < dimensions.Height; i++)
                    {
                        pos = new IntVec(dimensions.X + dimensions.Width, dimensions.Y + i);
                        if (floorPlan[pos.X, pos.Y])
                        {
                            currentOpening++;
                        }
                        else
                        {
                            currentOpening = 0;
                        }
                        largest = Math.Max(largest, currentOpening);
                    }

                    for (int i = 0; i < dimensions.Width; i++)
                    {
                        pos = new IntVec(dimensions.X + i, dimensions.Y + dimensions.Height);
                        if (floorPlan[pos.X, pos.Y])
                        {
                            currentOpening++;
                        }
                        else
                        {
                            currentOpening = 0;
                        }
                        largest = Math.Max(largest, currentOpening);
                    }
                    return(largest);
                }