public void Summon(BaseCharacterEntity summoner, SummonType summonType, short level) { Summoner = summoner; SummonType = summonType; Level = level; InitStats(); }
public static CharacterSummon Create(SummonType type, int dataId) { var newSummon = new CharacterSummon(); newSummon.type = type; newSummon.dataId = dataId; return(newSummon); }
public static SpellSummonEntry GetSummonEntry(SummonType type) { SpellSummonEntry entry; if (!SummonEntries.TryGetValue(type, out entry)) { log.Warn("Missing SpellSummonEntry for type: " + type); return(SummonEntries[SummonType.SummonPet]); } return(entry); }
public static void Contract(string assetPath, SummonType summonType) { if (!initialized) { Initialize(); } var entry = new Entry { id = entries.Count + 1, assetPath = assetPath, summonType = summonType }; entries.Add(entry); }
public void Deserialize(NetDataReader reader) { type = (SummonType)reader.GetByte(); if (type != SummonType.None) { dataId = reader.GetInt(); switch (type) { case SummonType.Skill: summonRemainsDuration = reader.GetFloat(); break; } objectId = reader.GetPackedUInt(); } }
public MapleSummon(int objectId, int sourceSkillId, Point position, SummonType type, SummonMovementType movementType, MapleCharacter owner, byte skillLevel, uint durationMS) { ObjectId = objectId; SourceSkillId = sourceSkillId; Position = position; Owner = owner; SkillLevel = skillLevel; Type = type; MovementType = movementType; HP = 0; LastAbilityTime = DateTime.FromFileTime(0); if (durationMS > 0) { CancelSchedule = Scheduler.ScheduleRemoveSummon(owner, sourceSkillId, durationMS); } }
public static int IndexOfSummon(this ICharacterData data, int dataId, SummonType type) { IList <CharacterSummon> list = data.Summons; CharacterSummon tempSummon; int index = -1; for (int i = 0; i < list.Count; ++i) { tempSummon = list[i]; if (tempSummon.dataId == dataId && tempSummon.type == type) { index = i; break; } } return(index); }
public static int IndexOfSummon(this ICharacterData data, SummonType type) { var list = data.Summons; CharacterSummon tempSummon; var index = -1; for (var i = 0; i < list.Count; ++i) { tempSummon = list[i]; if (tempSummon.type == type) { index = i; break; } } return(index); }
public static CurrencyTypes ConvertSummonTypeToCurrency(SummonType type) { switch (type) { case SummonType.Common: return(CurrencyTypes.SCROLLS_SUMMON_COMMON); case SummonType.Rare: return(CurrencyTypes.SCROLLS_SUMMON_RARE); case SummonType.MonsterDark: return(CurrencyTypes.SCROLLS_SUMMON_MONSTER_DARK); case SummonType.MonsterFire: return(CurrencyTypes.SCROLLS_SUMMON_MONSTER_FIRE); case SummonType.MonsterLight: return(CurrencyTypes.SCROLLS_SUMMON_MONSTER_LIGHT); case SummonType.MonsterWater: return(CurrencyTypes.SCROLLS_SUMMON_MONSTER_WATER); case SummonType.MonsterNature: return(CurrencyTypes.SCROLLS_SUMMON_MONSTER_NATURE); default: return(CurrencyTypes.GOLD); } }
public static SpellSummonHandler GetSummonHandler(SummonType type) { SpellSummonHandler handler; if (!SummonHandlers.TryGetValue(type, out handler)) { handler = DefaultSummonHandler; } return handler; }
public static SpellSummonEntry GetSummonEntry(SummonType type) { SpellSummonEntry entry; if (!SummonEntries.TryGetValue(type, out entry)) { log.Warn("Missing SpellSummonEntry for type: " + type); return SummonEntries[SummonType.SummonPet]; } return entry; }
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); } }); }