Beispiel #1
0
    public HeroData(int ID, string Identity, string Name, HeroClass Class, HeroType Type, ElementalTypes elementalType,
                    int Strength, int Vitality, int Intelligence, int Speed,
                    float StrengthScale, float VitalityScale, float IntelligenceScale, float SpeedScale,
                    float StrengthQualityScale, float VitalityQualityScale, float IntelligenceQualityScale, float SpeedQualityScale,
                    float StrengthQualityBase, float VitalityQualityBase, float IntelligenceQualityBase, float SpeedQualityBase,
                    LeaderSkill leaderSkill, string defaultWeapon, string awakenReference, List <Skill> Skills, int order, int rarity) : base(Identity, Name)
    {
        this.ID                   = ID;
        _class                    = Class;
        _type                     = Type;
        _elementalType            = elementalType;
        _strength                 = Strength;
        _vitality                 = Vitality;
        _intelligence             = Intelligence;
        _speed                    = Speed;
        _strengthScale            = StrengthScale;
        _vitalityScale            = VitalityScale;
        _intelligenceScale        = IntelligenceScale;
        _speedScale               = SpeedScale;
        _strengthQualityScale     = StrengthQualityScale;
        _vitalityQualityScale     = VitalityQualityScale;
        _intelligenceQualityScale = IntelligenceQualityScale;
        _speedQualityScale        = SpeedQualityScale;
        _strengthQualityBase      = StrengthQualityBase;
        _vitalityQualityBase      = VitalityQualityBase;
        _intelligenceQualityBase  = IntelligenceQualityBase;
        _speedQualityBase         = SpeedQualityBase;
        _leaderSkill              = leaderSkill;
        _defaultWeapon            = defaultWeapon;
        _awakenReference          = DataManager.Instance.heroDataList.GetByIdentity(awakenReference);
        _order                    = order;
        _rarity                   = rarity;

        this.Skills = Skills;
    }
Beispiel #2
0
 public Spell(string name, int power, int cost, ElementalTypes et, BasicSpellTypes st)
 {
     Name = name;
     Power = power;
     Cost = cost;
     Element = et;
     SpellType = st;
 }
Beispiel #3
0
 public ButtonElement(SpriteAnimation spriteAnimation,
                      Vector2 location, ElementalTypes value)
     : base(spriteAnimation, location, 0, 0)
 {
     Type = value;
     this.FixedScreenLocation = location;
     CenterOfSpriteX          = this.CenterofSprite.X;
     // LocationOfCenterOfText = font.MeasureString(Type.ToString()).X / 2;
 }
Beispiel #4
0
        public Enemies Copy(float Speed, int health, int Gold, ElementalTypes type)
        {
            Enemies enem = new Enemies(new SpriteAnimation(spriteAnimation), location, Speed, 0, health);

            enem.Type = Type;
            enem.Type = type;
            enem.gold = Gold;
            return(enem);
        }
Beispiel #5
0
            //[DataRow(ElementalTypes.lightning, typeof(LightningElemental))]
            public void ClassValidity(ElementalTypes type, Type expected)
            {
                const int DIFF = 1;
                Entity    ent  = ElementalFactory.createElemental(type, DIFF);

                try
                {
                    Convert.ChangeType(ent, expected);
                }
                catch
                {
                    Assert.Fail();
                }
            }
Beispiel #6
0
            public void DifficultyRange(ElementalTypes type, int difficulty)
            {
                const int MaxDeviation_ATT = 2;
                const int MaxDeviation_DEF = 2;

                int    targetvalue_att = difficulty * 2;
                int    targetvalue_def = difficulty * 4;
                Entity ent             = ElementalFactory.createElemental(type, difficulty);
                int    deviation_att   = Math.Abs(targetvalue_att - ent.Attack);
                int    deviation_def   = Math.Abs(targetvalue_def - ent.Defence);

                Assert.IsTrue(deviation_att <= MaxDeviation_ATT);
                Assert.IsTrue(deviation_def <= MaxDeviation_DEF);
            }
        private bool CheckIfElementsRequirementMet(Tower SourceTower, Tower DestinationTower)
        {
            List <Edge> Edges           = SourceTower.TowersThisCanBeUpgradedInto;
            Edge        ForTowerToBuilt = null;

            foreach (Edge e in Edges)
            {
                if (e.Destination == DestinationTower)
                {
                    ForTowerToBuilt = e;
                    break;
                }
            }

            ElementalTypes[] TypesOfElementsRequired = new ElementalTypes[ForTowerToBuilt.ElementsRequiredToCreate.Count];
            ForTowerToBuilt.ElementsRequiredToCreate.CopyTo(TypesOfElementsRequired);
            List <ElementalTypes> TypeOfElementsRequiredList = new List <ElementalTypes>(TypesOfElementsRequired);


            ElementalTypes[] TypesOfElementsBought = new ElementalTypes[BoughtElementsList.Count];
            BoughtElementsList.CopyTo(TypesOfElementsBought);
            List <ElementalTypes> TypesOfElementsBoughtList = new List <ElementalTypes>(TypesOfElementsBought);


            for (int i = TypeOfElementsRequiredList.Count - 1; i >= 0; i--)
            {
                ElementalTypes TypeReq = TypeOfElementsRequiredList[i];
                for (int j = TypesOfElementsBoughtList.Count - 1; j >= 0; j--)
                {
                    ElementalTypes TypeBought = TypesOfElementsBoughtList[j];

                    if (TypeBought == TypeReq)
                    {
                        TypeOfElementsRequiredList.RemoveAt(i);
                        TypesOfElementsBoughtList.RemoveAt(j);
                        break;
                    }
                }
            }

            if (TypeOfElementsRequiredList.Count == 0)
            {
                return(true);
            }

            return(false);
        }
 public TowerDataHolder(SpriteAnimation spriteAnimation,
                        SpriteAnimation TurretAnim,
                        ElementalTypes Type,
                        Texture2D ButtonImage,
                        float TowerRange,
                        float DelayBetweenShots,
                        int Damage,
                        int Aoe)
 {
     this.spriteAnimation   = spriteAnimation;
     this.TurretAnim        = TurretAnim;
     this.TowerRange        = TowerRange;
     this.DelayBetweenShots = DelayBetweenShots;
     this.Damage            = Damage;
     this.Type        = Type;
     this.ButtonImage = ButtonImage;
     this.Aoe         = Aoe;
 }
Beispiel #9
0
    public AffixData(string Identity, string Name, AffixType Type, bool onUnique, bool onRare, bool onMagic, int MinLevel, float Frequency, List <ItemType> RestrictedToItems, ElementalTypes RestrictedElement, SkillType RestrictedSkillType, ItemModData data)
    {
        this.Identity = Identity;
        this.Name     = Name;
        this.Type     = Type;

        this.onUnique = onUnique;
        this.onRare   = onRare;
        this.onMagic  = onMagic;

        this.MinLevel  = MinLevel;
        this.Frequency = Frequency;

        this.RestrictedToItems   = RestrictedToItems;
        this.RestrictedElement   = RestrictedElement;
        this.RestrictedSkillType = RestrictedSkillType;

        this.data = data;
    }
Beispiel #10
0
    public static bool IsElementACounter(ElementalTypes type, ElementalTypes target)
    {
        switch (target)
        {
        case ElementalTypes.Light:
            if (type == ElementalTypes.Dark)
            {
                return(true);
            }
            break;

        case ElementalTypes.Dark:
            if (type == ElementalTypes.Light)
            {
                return(true);
            }
            break;

        case ElementalTypes.Nature:
            if (type == ElementalTypes.Fire)
            {
                return(true);
            }
            break;

        case ElementalTypes.Fire:
            if (type == ElementalTypes.Water)
            {
                return(true);
            }
            break;

        case ElementalTypes.Water:
            if (type == ElementalTypes.Nature)
            {
                return(true);
            }
            break;
        }

        return(false);
    }
        public Tower CreateTower(SpriteAnimation spriteAnimation,
                                 SpriteAnimation TurretAnim,
                                 Texture2D ButtonImage,
                                 string Name,
                                 ElementalTypes Type,
                                 Vector2 location,
                                 float speed,
                                 int collisionRadius,
                                 float TowerRange,
                                 float DelayBetweenShots,
                                 int Damage,
                                 int Aoe,
                                 params Edge[] edges)
        {
            Tower T = new Tower(spriteAnimation, TurretAnim, ButtonImage, Name, Type, location, speed, collisionRadius, TowerRange,
                                DelayBetweenShots, Damage, Aoe, edges);

            AdjacentList.Add(Name, T);

            return(T);
        }
Beispiel #12
0
    public BossData(string Identity, string name, int Health, int Damage, int Defense, int Speed, ElementalTypes EType, string Sprite, /*List<Skill> Skills,*/ BossPhaseSkillList PhaseSkillList, List <BossPatternTrigger> PhaseTriggers) : base(Identity, name, Health)
    {
        //moved name, maxhealth and health to Entity ("health = maxHealth" in Entity too).
        _damage       = Damage;
        _defense      = Defense;
        _speed        = Speed;
        elementalType = EType;
        this.Sprite   = Sprite;

        Phases             = PhaseSkillList;
        this.PhaseTriggers = PhaseTriggers;

        string triggerText = "";

        foreach (BossPatternTrigger trig in this.PhaseTriggers)
        {
            triggerText += trig.ToString() + "\n";
        }

        //Debug.Log("Adding Phase Triggers to " + name + "\n" + (triggerText.Length < 1 ? "None" : triggerText));
    }
Beispiel #13
0
        public static Entity createElemental(ElementalTypes type, int difficultyLevel)
        {
            Entity    enemy;
            const int ATT = 2;
            const int DEF = 4;

            switch (type)
            {
            default:
            case ElementalTypes.air:
                enemy = new Enemies.AirElemental("air", 10, difficultyLevel * ATT, difficultyLevel * DEF); break;

            case ElementalTypes.earth:
                enemy = new Enemies.EarthElemental("earth", 10, difficultyLevel * ATT, difficultyLevel * DEF); break;

            case ElementalTypes.fire:
                enemy = new Enemies.FireElemental("fire", 10, difficultyLevel * ATT, difficultyLevel * DEF); break;

            case ElementalTypes.water:
                enemy = new Enemies.WaterElemental("water", 10, difficultyLevel * ATT, difficultyLevel * DEF); break;
            }
            return(enemy);
        }
Beispiel #14
0
    public void Initialize(string name, Sprite sprite, ElementalTypes elementalType = ElementalTypes.None)
    {
        BossName.text    = name;
        BossImage.sprite = sprite;

        WeaknessImage.gameObject.SetActive(true);
        Sprite elementalSprite = null;

        switch (elementalType)
        {
        case ElementalTypes.Fire:
            elementalSprite = Resources.Load <Sprite>("Items/None/element_water");
            break;

        case ElementalTypes.Water:
            elementalSprite = Resources.Load <Sprite>("Items/None/element_nature");
            break;

        case ElementalTypes.Nature:
            elementalSprite = Resources.Load <Sprite>("Items/None/element_fire");
            break;

        case ElementalTypes.Dark:
            elementalSprite = Resources.Load <Sprite>("Items/None/element_light");
            break;

        case ElementalTypes.Light:
            elementalSprite = Resources.Load <Sprite>("Items/None/element_dark");
            break;

        default:
            WeaknessImage.gameObject.SetActive(false);
            break;
        }

        WeaknessImage.sprite = elementalSprite;
    }
Beispiel #15
0
        public Tower(SpriteAnimation baseAnim,
                     SpriteAnimation TurretAnim,
                     Texture2D ButtonImage,
                     string Name,
                     ElementalTypes Type,
                     Vector2 location,
                     float speed,
                     int collisionRadius,
                     float TowerRange,
                     float DelayBetweenShots,
                     int Damage,
                     int Aoe,
                     params Edge[] edges)
            : base(baseAnim, location, speed, collisionRadius)
        {
            this.TurretAnim        = TurretAnim;
            this.TowerRange        = TowerRange;
            this.DelayBetweenShots = DelayBetweenShots;
            this.Damage            = Damage;
            this.TowerName         = Name;
            this.ButtonImage       = ButtonImage;
            this.Type           = Type;
            this.Aoe            = Aoe;
            AutoRotate          = false;
            circleRangeLocation = new Vector2((location.X - (int)TowerRange), (location.Y - (int)TowerRange));

            if (SpecificBullet == null)
            {
                SpecificBullet = projectile;
            }

            foreach (Edge a in edges)
            {
                TowersThisCanBeUpgradedInto.Add(a);
            }
        }
 public MonsterData(string Identity, string name, ElementalTypes Element, TapMonsterType TapType, string Sprite) : base(Identity, name, 0)
 {
     this.Element = Element;
     this.TapType = TapType;
     this.Sprite  = Sprite;
 }
Beispiel #17
0
    public void SummonHeroAction(SummonType type, Action <Hero> callback = null)
    {
        CurrencyTypes scrollType   = CurrencyManager.ConvertSummonTypeToCurrency(type);
        int           scrollsTotal = scrollType.GetAmount();

        if (scrollsTotal < 1)
        {
            throw new Exception("Unsufficient scrolls to summon the specified type: " + type + " => " + scrollType + ", scrolls: " + scrollsTotal);
        }

        int Seed = GetSeed();

        isSummonComplete = false;

        List <HeroData> possibleSummons = new List <HeroData>();
        HeroType        summonType      = HeroType.Monster;
        ElementalTypes  ElementalType   = ElementalTypes.None;
        float           chance          = Random.Range(0f, 1f);

        // Determine the type of hero to summon
        switch (type)
        {
        case SummonType.Common:

            if (chance <= GlobalProps.SUMMON_COMMON_HERO.GetFloat())
            {
                summonType = HeroType.Hero;
            }
            else if (chance <= (GlobalProps.SUMMON_COMMON_HERO.GetFloat() + GlobalProps.SUMMON_COMMON_SOLDIER.GetFloat()))
            {
                summonType = HeroType.Soldier;
            }
            else
            {
                summonType = HeroType.Monster;
            }

            break;

        case SummonType.Rare:

            if (chance <= GlobalProps.SUMMON_RARE_HERO.GetFloat())
            {
                summonType = HeroType.Hero;
            }
            else if (chance <= (GlobalProps.SUMMON_RARE_HERO.GetFloat() + GlobalProps.SUMMON_RARE_MONSTER.GetFloat()))
            {
                summonType = HeroType.Monster;
            }
            else
            {
                summonType = HeroType.Soldier;
            }

            break;

        case SummonType.MonsterFire: ElementalType = ElementalTypes.Fire; break;

        case SummonType.MonsterWater: ElementalType = ElementalTypes.Water; break;

        case SummonType.MonsterNature: ElementalType = ElementalTypes.Nature; break;

        case SummonType.MonsterDark: ElementalType = ElementalTypes.Dark; break;

        case SummonType.MonsterLight: ElementalType = ElementalTypes.Light; break;
        }

        possibleSummons = dataMan.heroDataList.FindAll(h => h.Type == summonType && h.AwokenReference == null);

        // Get the hero data list based on the types
        if (ElementalType != ElementalTypes.None)
        {
            // Summon w/ element (filter again from the above filtered list)
            possibleSummons = possibleSummons.FindAll(h => h.ElementalType == ElementalType);
        }

        Dictionary <HeroData, float> HeroChance = new Dictionary <HeroData, float>();

        foreach (HeroData hd in possibleSummons)
        {
            HeroChance.Add(hd, hd.Rarity);
        }

        // Get the hero from the list
        int summonIndex = Random.Range(0, possibleSummons.Count);

        trace(summonIndex);

        //eroChance.GetRandom();
        HeroData heroData = MathHelper.WeightedRandom(HeroChance).Key; //possibleSummons[summonIndex];

        //heroData = dataMan.heroDataList.GetByIdentity("hero_rareassassin"); // for testing awakening
        Hero tempHero = new Hero(heroData, Seed);

        trace("-- Summoning a hero: " + tempHero.Name + " [" + tempHero.Quality + "] (possibilities: " + possibleSummons.Count + ")\n" + (scrollsTotal - 1));

        SummonInterface summonUI = (SummonInterface)MenuManager.Instance.Push("Interface_SummonHero");

        //First, do the currency transaction:
        API.Currency.AddCurrency(scrollType, -1)
        //Then, do the actual adding of the new hero:
        .Then(res => API.Heroes.Add(tempHero))
        .Then(res => {
            Hero SelectedHero = dataMan.ProcessHeroData(res["newest"].AsArray[0]);

            summonUI.Initialize(SelectedHero);

            if (callback != null)
            {
                callback(SelectedHero);
            }
            if (signals.OnHeroCreated != null)
            {
                signals.OnHeroCreated(SelectedHero);
            }
        });
    }
 public ItemArtifact(int ID, string Identity, string Name, int Value, string Description, string Sprite, int Tier, float Multiplier, int baseSkillLevel, ElementalTypes ElementalType, List <UniqueReference> UniqueItemReference) : base(ID, Identity, Name, ItemType.Artifact, EquipmentType.Artifact, Value, Description, Sprite, Tier, Multiplier, UniqueItemReference)
 {
     this._skillLevel   = baseSkillLevel;
     this.ElementalType = ElementalType;
 }
Beispiel #19
0
        public Bullet Copy(Vector2 location, Enemies enemToFollow, int Damage, int Aoe, ElementalTypes Type)
        {
            Bullet b = new Bullet(new SpriteAnimation(spriteAnimation), location, speed, Damage, Aoe);

            b.AoeEffect     = AoeEffect;
            b.Type          = Type;
            b.enemyToFollow = enemyToFollow;
            b.AutoRotate    = AutoRotate;
            b.isGrow        = isGrow;
            return(b);
        }
Beispiel #20
0
 public void GetHit(int Damage, ElementalTypes TypeAttacked)
 {
     health -= (int)(Damage * damageTable[(int)TypeAttacked, (int)Type]);
 }
 public ItemArtifact(ItemArtifact data) : base(data.ID, data.Name, data.Identity, ItemType.Artifact, EquipmentType.Artifact, data.Value, data.Description, data.Sprite, data.Tier, data.Multiplier, data.UniqueItemReference)
 {
     this._skillLevel   = data.SkillLevel;
     this.ElementalType = data.ElementalType;
 }