protected void Page_Load(object sender, EventArgs e) { if (Session["User"] == null) { Session["ErrorMessage"] = "You need to be logged in first"; Response.Redirect("~/Login.aspx"); } user = (UserObject)Session["User"]; if (user.character == null) { Session["ErrorMessage"] = "You need to have a card character before battling."; Response.Redirect("~/CreateAChar.aspx"); } self = (CharacterObject)user.character; if (Session["Opponent"] == null) { Response.Redirect("~/Default.aspx"); } opponent = (CharacterObject)Session["Opponent"]; litAtk.Text = "<span>" + self.Attack + "</span>"; imgSelf.ImageUrl = self.ImageUrl; litHp.Text = "<span>?/?</span>"; imgOther.ImageUrl = opponent.ImageUrl; }
public CharacterControllerInput(IScene scene, Vector3 position, float characterHeight, float characterWidth, float mass, Vector3 scale,float Yalignement = 0) : base(scene) { Characterobj = new CharacterObject(position, Matrix.Identity, characterHeight, characterWidth, mass, 1f, scale, Yalignement); this.Start(); }
public void Print(XmlTextWriter objWriter) { objWriter.WriteStartElement("skill"); int rating = PoolOtherAttribute(AttributeObject.TotalValue); int specRating = Specializations.Count == 0 ? rating : (!IsKnowledgeSkill && Name == "Artisan" && CharacterObject.Qualities.Any(objQuality => objQuality.Name == "Inspired") ? rating + 3 : rating + 2); int ratingModifiers = RatingModifiers, dicePoolModifiers = PoolModifiers; objWriter.WriteElementString("name", DisplayName); objWriter.WriteElementString("skillgroup", SkillGroupObject?.DisplayName ?? LanguageManager.Instance.GetString("String_None")); objWriter.WriteElementString("skillgroup_english", SkillGroupObject?.Name ?? LanguageManager.Instance.GetString("String_None")); objWriter.WriteElementString("skillcategory", DisplayCategory); objWriter.WriteElementString("skillcategory_english", SkillCategory); //Might exist legacy but not existing atm, will see if stuff breaks objWriter.WriteElementString("grouped", (SkillGroupObject?.CareerIncrease).ToString()); objWriter.WriteElementString("default", Default.ToString()); objWriter.WriteElementString("rating", Rating.ToString()); objWriter.WriteElementString("ratingmax", RatingMaximum.ToString()); objWriter.WriteElementString("specializedrating", specRating.ToString()); objWriter.WriteElementString("total", PoolOtherAttribute(AttributeObject.TotalValue).ToString()); objWriter.WriteElementString("knowledge", IsKnowledgeSkill.ToString()); objWriter.WriteElementString("exotic", IsExoticSkill.ToString()); objWriter.WriteElementString("buywithkarma", BuyWithKarma.ToString()); objWriter.WriteElementString("base", Base.ToString()); objWriter.WriteElementString("karma", Karma.ToString()); objWriter.WriteElementString("spec", DisplaySpecialization); objWriter.WriteElementString("attribute", Attribute); objWriter.WriteElementString("displayattribute", DisplayAttribute); objWriter.WriteElementString("notes", _strNotes); objWriter.WriteElementString("source", CharacterObject.Options.LanguageBookShort(Source)); objWriter.WriteElementString("page", Page); objWriter.WriteElementString("attributemod", CharacterObject.GetAttribute(Attribute).TotalValue.ToString()); objWriter.WriteElementString("ratingmod", (ratingModifiers + dicePoolModifiers).ToString()); objWriter.WriteElementString("poolmod", dicePoolModifiers.ToString()); objWriter.WriteElementString("islanguage", (SkillCategory == "Language").ToString()); objWriter.WriteElementString("bp", CurrentKarmaCost().ToString()); objWriter.WriteStartElement("skillspecializations"); foreach (SkillSpecialization objSpec in Specializations) { objSpec.Print(objWriter); } objWriter.WriteEndElement(); objWriter.WriteEndElement(); }
public static void NPCToSouse(CharacterObject character, CampaignGameStarter campaignGameStarter) { Hero hero = DealNPC(character, campaignGameStarter); if (null != hero) { //去掉它的伙伴属性 hero.CompanionOf = null; OccuptionChange.ChangeOccupationToLord(hero.CharacterObject); MarryHero(hero); hero.IsNoble = true; RefreshClanPanelList(hero); } }
private List <AbilityActivationData> ActivateAbilities(CharacterObject character, List <EPlayerAction> actions) { List <AbilityActivationData> actionsExecuted = new List <AbilityActivationData>(); foreach (EPlayerAction action in actions) { int index = 0; switch (action) { case EPlayerAction.ACTIVATE_ABILITY_0: index = 0; break; case EPlayerAction.ACTIVATE_ABILITY_1: index = 1; break; case EPlayerAction.ACTIVATE_ABILITY_2: index = 2; break; case EPlayerAction.ACTIVATE_ABILITY_3: index = 3; break; case EPlayerAction.ACTIVATE_ABILITY_4: index = 4; break; case EPlayerAction.ACTIVATE_ABILITY_5: index = 5; break; default: break; } bool actionExecuted = character.ActivateAbility(index); if (actionExecuted) { System.Numerics.Vector2 attackPoint = new System.Numerics.Vector2(character.attackPoint.x, character.attackPoint.y); System.Numerics.Vector2 direction = new System.Numerics.Vector2(character.GetAttackDirection().x, character.GetAttackDirection().y); actionsExecuted.Add(new AbilityActivationData(index, attackPoint, direction)); } } return(actionsExecuted); }
public override void Start() { base.Start(); mWeapon = RequireComponent <BaseWeapon>(); mMessage = RequireComponent <MmoMessageComponent>(); mCharacter = RequireComponent <CharacterObject>(); mTarget = RequireComponent <PlayerTarget>(); mMovable = GetComponent <MovableObject>(); m_Skills = GetComponent <PlayerSkills>(); m_Bonuses = GetComponent <PlayerBonuses>(); mChestLiveDuration = nebulaObject.world.Resource().ServerInputs.GetValue <float>("chest_life"); //log.InfoFormat("chest life = {0}", mChestLiveDuration); mShotTimer = m_ShotCooldown; mDead = false; combatAIType = aiType as CombatAIType; if (combatAIType == null) { log.Error("CombatBasseAI must have CombatAIType, but not simple AIType"); } mShipWeapon = GetComponent <ShipWeapon>(); if (Rand.Int() % 2 == 0) { mMovNearTargetType = MovingNearTarget.Circle; } else { mMovNearTargetType = MovingNearTarget.LIne; } mStartPosition = nebulaObject.transform.position; #if USE_SKILLS //--------------------------TESTING------------------------------------ var ship = GetComponent <BaseShip>(); if (ship) { string sSkill = skills[Rand.Int(skills.Count - 1)]; ship.shipModel.Slot(ShipModelSlotType.CB).Module.SetSkill(SkillExecutor.SkilIDFromHexString(sSkill)); mSkills = GetComponent <PlayerSkills>(); mSkills.UpdateSkills(ship.shipModel); } //-------------------------------------------------------------------- #endif mBotObject = GetComponent <BotObject>(); SetupSkills(); }
// MapEventSide.ApplySimulationDamageToSelectedTroop public static bool ApplySimulationDamageToSelectedTroop(MapEventSide side, CharacterObject strikedTroop, PartyBase strikedTroopParty, UniqueTroopDescriptor strikedTroopDescriptor, int selectedSimulationTroopIndex, List <UniqueTroopDescriptor> strikedTroopList, PartyAttackComposition attack, DamageTypes damageType, PartyBase strikerParty, MapEventState mapEventState, IBattleObserver battleObserver, out float damage) { bool IsFinishingStrike = mapEventState.ApplyDamageToPartyTroop(attack, strikedTroopParty, strikedTroop, out damage); if (IsFinishingStrike) { if (strikedTroop.IsHero) { battleObserver?.TroopNumberChanged(side.MissionSide, (IBattleCombatant)strikedTroopParty, (BasicCharacterObject)strikedTroop, -1, 0, 1, 0, 0, 0); } else { float survivalChance = Campaign.Current.Models.PartyHealingModel.GetSurvivalChance(strikedTroopParty, strikedTroop, damageType, strikerParty); if (MBRandom.RandomFloat < survivalChance) { side.OnTroopWounded(strikedTroopDescriptor); battleObserver?.TroopNumberChanged(side.MissionSide, (IBattleCombatant)strikedTroopParty, (BasicCharacterObject)strikedTroop, -1, 0, 1, 0, 0, 0); if (strikedTroopParty.MobileParty != null) { SkillLevelingManager.OnSurgeryApplied(strikedTroopParty.MobileParty, 1f); } } else { side.OnTroopKilled(strikedTroopDescriptor); battleObserver?.TroopNumberChanged(side.MissionSide, (IBattleCombatant)strikedTroopParty, (BasicCharacterObject)strikedTroop, -1, 1, 0, 0, 0, 0); if (strikedTroopParty.MobileParty != null) { SkillLevelingManager.OnSurgeryApplied(strikedTroopParty.MobileParty, 0.5f); } } } // side.RemoveSelectedTroopFromSimulationList(); RemoveSelectedTroopFromSimulationList(side, selectedSimulationTroopIndex, strikedTroopList); } return(IsFinishingStrike); }
/// <summary> /// Get the best item from inventory side /// </summary> /// <param name="itemListVM">List of items on the inventory side</param> /// <param name="equipmentElement">Current item</param> /// <param name="slot">Type of item</param> /// <param name="isCivilian">Civilian Type</param> /// <returns></returns> public EquipmentElement GetBetterItemFromSide(MBBindingList <SPItemVM> itemListVM, EquipmentElement equipmentElement, EquipmentIndex slot, bool isCivilian) { EquipmentElement bestEquipmentElement; CharacterObject character = _characterData.GetCharacterObject(); // Loops through the inventory list to find the best equipment item foreach (SPItemVM item in itemListVM) { // Skips through the process if the item is camel or camel harness if (IsCamel(item) || IsCamelHarness(item)) { continue; } // Skips only if the character cannot use the item or the item is not equipable if (!CharacterHelper.CanUseItem(character, item.ItemRosterElement.EquipmentElement) || !item.IsEquipableItem) { continue; } // Skips only if we are looking for civilian equipment and item is not civilian equipment if (isCivilian && !item.IsCivilianItem) { continue; } if (slot < EquipmentIndex.NonWeaponItemBeginSlot && item.ItemRosterElement.EquipmentElement.Item.PrimaryWeapon != null) { bool sameWeaponClass = equipmentElement.Item.WeaponComponent.PrimaryWeapon.WeaponClass == item.ItemRosterElement.EquipmentElement.Item.PrimaryWeapon.WeaponClass; bool sameItemUsage = GetItemUsage(item) == equipmentElement.Item.PrimaryWeapon.ItemUsage; bool couchWeapon = IsCouchWeapon(equipmentElement); bool couchUsage = !couchWeapon || IsCouchWeapon(item.ItemRosterElement.EquipmentElement); if (sameWeaponClass && sameItemUsage && couchUsage) { bestEquipmentElement = GetBestEquipmentElement(slot, item.ItemRosterElement.EquipmentElement, equipmentElement, bestEquipmentElement); } } else if (item.ItemType == slot) { bestEquipmentElement = GetBestEquipmentElement(slot, item.ItemRosterElement.EquipmentElement, equipmentElement, bestEquipmentElement); } } return(bestEquipmentElement); }
private static bool Prefix(CharacterObject attackerTroop, CharacterObject attackedTroop, int damage, bool isFatal, CombatXpModel.MissionTypeEnum missionType, out int xpAmount) { #if VERSION111 int num = attackedTroop.MaxHitPoints(); xpAmount = MBMath.Round(0.4f * ((attackedTroop.GetPower() + 0.5f) * (float)(Math.Min(damage, num) + (isFatal ? num : 0)))); if (missionType == CombatXpModel.MissionTypeEnum.SimulationBattle) { #pragma warning disable CS1717 // Assignment made to same variable xpAmount = xpAmount; #pragma warning restore CS1717 // Assignment made to same variable } if (missionType == CombatXpModel.MissionTypeEnum.PracticeFight) { xpAmount = MathF.Round((float)xpAmount * TournamentXPSettings.Instance.ArenaXPAdjustment); } if (missionType == CombatXpModel.MissionTypeEnum.Tournament) { xpAmount = MathF.Round((float)xpAmount * TournamentXPSettings.Instance.TournamentXPAdjustment); } #endif #if VERSION120 float single; int num = attackedTroop.MaxHitPoints(); float power = 0.4f * ((attackedTroop.GetPower() + 0.5f) * (Math.Min(damage, num) + (isFatal ? num : 0))); if (missionType == CombatXpModel.MissionTypeEnum.NoXp) { single = 0f; } else if (missionType == CombatXpModel.MissionTypeEnum.PracticeFight) { single = TournamentXPSettings.Instance.ArenaXPAdjustment; } else if (missionType == CombatXpModel.MissionTypeEnum.Tournament) { single = TournamentXPSettings.Instance.TournamentXPAdjustment; } else if (missionType == CombatXpModel.MissionTypeEnum.SimulationBattle) { single = 0.9f; } else { single = (missionType == CombatXpModel.MissionTypeEnum.Battle ? 1f : 1f); } xpAmount = MathF.Round(power * single); #endif return(false); }
internal void MakeFreedHeroesEscape(TroopRoster freedTroops) { for (int i = freedTroops.Count <TroopRosterElement>() - 1; i >= 0; i--) { CharacterObject characterAtIndex = freedTroops.GetCharacterAtIndex(i); if (characterAtIndex.IsHero) { if (!characterAtIndex.IsPlayerCharacter) { EndCaptivityAction.ApplyByReleasedAfterBattle(characterAtIndex.HeroObject, null, null); } freedTroops.RemoveTroop(characterAtIndex, 1, new UniqueTroopDescriptor(), 0); } } }
public static void GetGoldCostForUpgrade(ref PartyBase party, ref CharacterObject characterObject, ref CharacterObject upgradeTarget, ref int __result) { try { if (party.IsPlayerParty() && BannerlordCheatsSettings.Instance?.FreeTroopUpgrades == true) { __result = 0; } } catch (Exception e) { SubModule.LogError(e, typeof(FreeTroopUpgrades)); } }
//[Header("Boomerang")] //public bool hasBeenThrown = false;//collision //public bool doCollision = false;//collision //public bool boomerangFlag = false;//ai on //public float boomerangTime = 20;//time spent turning back to the player //public float orient = 0; //direction boomerang turns in the boomerang state //public float turnAmount = 0; //how much boomerang has turned, used to end the state //public float direction; // //public int state; //public Vector3 velocity; //public Vector3 friction = new Vector3(0.95f, 0.99f, 0.95f); private void Awake() { kzSprite = GetComponent <SpriteRenderer>(); kzRB = GetComponent <Rigidbody2D>(); kzColl = GetComponent <Collider2D>(); thrower = GameEngine.gameEngine.mainCharacter; hitbox = GetComponent <Hitbox>(); audioManager = AudioManager.instance; if (audioManager == null) { Debug.LogError("No Audio Manager in Scene"); } kState = ThrowingState.Recalling; }
public void purchaseCharacter(CharacterObject charobj) { if (ValueManager.instance.Purchase(charobj.Cost)) { ValueManager.instance.updateText(); CharacterDetailPanel.SetActive(false); charobj.Purchased = true; } else { ErrorManager.instance.SetMessage("Not Enough Sugar to Purchase this Character"); ErrorManager.instance.ShowMessage(); Debug.Log("Not Enough Sugar"); } }
public static bool Prefix(ref float __result, CharacterObject __instance) { if (SubModule.Settings.Battle_SendAllTroops_DetailedCombatModel) { TroopTemplate template = TroopTemplate.GetTroopTemplate(__instance); __result = template.Strength; return(false); } else { return(true); } }
void Start() { // find objects PauseMenuScript.CharMouseLook = CharacterObject.GetComponent <MouseLook>(); CharacterDO = CharacterObject.GetComponent <CharacterObject>(); CharacterDO.Controller = this; SeedObject.GetComponent <SeedObject>().Controller = this; SeedObject.GetComponentInChildren <SeedUI>().Controller = this; SeedDO = SeedObject.GetComponent <SeedObject>(); ChangeGameState(GameState.Begin); }
private void OnConversationEnded(CharacterObject character) { if (meetingEncounter != null) { PlayerEncounter.Finish(false); meetingEncounter = null; meetingHero = null; AccessTools.Property(typeof(Campaign), "PlayerEncounter").SetValue(Campaign.Current, keepEncounter); keepEncounter = null; AccessTools.Property(typeof(Campaign), "LocationEncounter").SetValue(Campaign.Current, keepLocation); keepLocation = null; Hero.MainHero.PartyBelongedTo.CurrentSettlement = keepSettlement; keepSettlement = null; } }
public void chooseCharacter(CharacterSlot characterslot) { if (Base.instance.AddCharacter()) { CharacterObject character = characterslot.charobj; playerSlot.charobj = character; playerSlot.icon.sprite = character.icon; character.Equiped = true; //characterObjects.Remove(character); //characterslot.gameObject.SetActive(false); playerSelectionPanel.gameObject.SetActive(false); menuPanel.gameObject.SetActive(true); CharacterDetailPanel.SetActive(false); } }
public static void HandleNameCache(ref PacketReader packet, ref WorldManager manager) { UInt64 guid = packet.ReadUInt64(); Character character = CharacterObject.GetCharacterByGuid(guid); PacketWriter nameCache = new PacketWriter(Opcodes.SMSG_NAME_QUERY_RESPONSE); nameCache.WriteUInt64(guid); nameCache.WriteString(character.Name); nameCache.WriteUInt32(character.Race); nameCache.WriteUInt32(character.Gender); nameCache.WriteUInt32(character.Class); nameCache.WriteUInt8(0); manager.Send(nameCache); }
public static void SimulateHit(ref CharacterObject strikerTroop, ref CharacterObject struckTroop, ref PartyBase strikerParty, ref PartyBase struckParty, ref float strikerAdvantage, ref MapEvent battle, ref int __result) { try { if (struckParty.IsPlayerParty() && BannerlordCheatsSettings.Instance?.AlwaysWinBattleSimulation == true) { __result = 0; } } catch (Exception e) { SubModule.LogError(e, typeof(AlwaysWinBattleSimulation)); } }
public void LoadDefaultType(string name) { if (name == null) { return; } //TODO: Should this be targeted against guid for uniqueness? Creating a knowledge skill in career always generates a new SkillId instead of using the one from skills. XmlNode skillNode = XmlManager.Load("skills.xml").SelectSingleNode($"chummer/knowledgeskills/skill[name = \"{name}\"]"); if (skillNode != null) { _type = skillNode["category"]?.InnerText ?? string.Empty; AttributeObject = CharacterObject.GetAttribute(skillNode["attribute"]?.InnerText ?? "LOG"); } }
static void _(CharacterObject character, Agent agent, int mark) { var args = new { character = character.ToString(), character_a = agent.Character.ToString(), h_character = character.GetHashCode(), h_character_a = agent.Character.GetHashCode(), cName = character.Name.ToString(), aName = agent.Name, mark, }; Console.WriteLine(args.ToJsonString()); }
public static void GetTroopRecruitmentCost(CharacterObject troop, Hero buyerHero, bool withoutItemCost, ref int __result) { try { if (buyerHero.IsPlayer() && BannerlordCheatsSettings.Instance?.FreeTroopRecruitment == true) { __result = 1; } } catch (Exception e) { SubModule.LogError(e, typeof(FreeTroopRecruitment)); } }
public void Initialize([NotNull] CharacterObject character) { profileImage.sprite = character.profilePicture; nameText.text = character.GetNameString(); aboutMeHeaderText.text = Localization.Localization.Get("aboutMe.Title"); dateOfBirthHeaderText.text = "<sprite=0>" + Localization.Localization.Get("aboutMe.Birthday"); locationHeaderText.text = "<sprite=0>" + Localization.Localization.Get("aboutMe.Location"); loginButtonText.text = Localization.Localization.Get("loginUI.Login"); dateOfBirthText.text = character.dayOfBirth + " / " + character.monthOfBirth + " / " + character.yearOfBirth; locationText.text = Localization.Localization.Get(character.location); mailText.text = Localization.Localization.Get(character.email); hobbiesText.text = string.Join("\n", character.hobbies.Select(Localization.Localization.Get)); }
public override void GetXpFromHit(CharacterObject attackerTroop, CharacterObject attackedTroop, int damage, bool isFatal, MissionTypeEnum missionType, out int xpAmount) { if (attackerTroop == null || attackedTroop == null) { xpAmount = 0; return; } int num = attackerTroop.MaxHitPoints(); xpAmount = MBMath.Round(0.4f * ((attackedTroop.GetPower() + 0.5f) * (float)(Math.Min(damage, num) + (isFatal ? num : 0)))); //There are three things to do here: Tournament Experience, Arena Experience, Troop Experience. if (attackerTroop.IsHero) { if (missionType == MissionTypeEnum.Tournament) { if (Settings.Instance.TournamentHeroExperienceMultiplierEnabled) { xpAmount = (int)MathF.Round(Settings.Instance.TournamentHeroExperienceMultiplier * (float)xpAmount); } else { xpAmount = MathF.Round((float)xpAmount * 0.25f); } } else if (missionType == MissionTypeEnum.PracticeFight) { if (Settings.Instance.ArenaHeroExperienceMultiplierEnabled) { xpAmount = (int)MathF.Round(Settings.Instance.ArenaHeroExperienceMultiplier * (float)xpAmount); } else { xpAmount = MathF.Round((float)xpAmount * 0.0625f); } } } else if ((missionType == MissionTypeEnum.Battle || missionType == MissionTypeEnum.SimulationBattle)) { if (Settings.Instance.TroopBattleSimulationExperienceMultiplierEnabled && missionType == MissionTypeEnum.SimulationBattle) { xpAmount = (int)MathF.Round(xpAmount * Settings.Instance.TroopBattleSimulationExperienceMultiplier); } else if (Settings.Instance.TroopBattleExperienceMultiplierEnabled && missionType == MissionTypeEnum.Battle) { xpAmount = (int)MathF.Round(xpAmount * Settings.Instance.TroopBattleExperienceMultiplier); } } }
private static bool StrikeOnce(MapEvent mapEvent, IBattleObserver battleObserver, MapEventSide strikerSide, MapEventSide strikedSide, PartyAttackComposition attack, out float totalDamageDone) { int strikerNumber = strikerSide.NumRemainingSimulationTroops; int strikedNumber = strikedSide.NumRemainingSimulationTroops; totalDamageDone = 0; if (strikerNumber == 0 || strikedNumber == 0) { return(true); } MapEventState mapEventState = MapEventState.GetMapEventState(mapEvent); bool finishedAnyone = false; for (int index = strikedNumber - 1; index >= 0; index--) { UniqueTroopDescriptor strikerTroopDescriptor = strikerSide.SelectRandomSimulationTroop(); CharacterObject strikerTroop = strikerSide.GetAllocatedTroop(strikerTroopDescriptor); PartyBase strikerTroopParty = strikerSide.GetAllocatedTroopParty(strikerTroopDescriptor); UniqueTroopDescriptor strikedTroopDescriptor = MapEventSideHelper.SelectSimulationTroopAtIndex(strikedSide, index, out List <UniqueTroopDescriptor> strikedTroopList); CharacterObject strikedTroop = strikedSide.GetAllocatedTroop(strikedTroopDescriptor); PartyBase strikedTroopParty = strikedSide.GetAllocatedTroopParty(strikedTroopDescriptor); // MapEvents.GetSimulatedDamage and CombatSimulationModel.SimulateHit if (mapEvent.IsPlayerSimulation && strikedTroopParty == PartyBase.MainParty) { float damageMultiplier = Campaign.Current.Models.DifficultyModel.GetPlayerTroopsReceivedDamageMultiplier(); attack *= damageMultiplier; } DamageTypes damageType = (double)MBRandom.RandomFloat < 0.15 ? DamageTypes.Blunt : DamageTypes.Cut; bool isFinishingStrike = MapEventSideHelper.ApplySimulationDamageToSelectedTroop( strikedSide, strikedTroop, strikedTroopParty, strikedTroopDescriptor, index, strikedTroopList, attack, damageType, strikerTroopParty, mapEventState, battleObserver, out float damage); totalDamageDone += damage; strikerSide.ApplySimulatedHitRewardToSelectedTroop(strikedTroop, 0, isFinishingStrike); finishedAnyone = finishedAnyone || isFinishingStrike; } return(finishedAnyone); }
public static Hero CreateNewBandit(Game game) { CultureObject banditCulture = null; // Search for Vagabond Culture banditCulture = MBObjectManager.Instance.GetObjectTypeList <CultureObject>().FirstOrDefault(x => x.IsMainCulture && x.GetName().ToString() == "Vagabond"); if (banditCulture != default(CultureObject)) { // If its not found use default culture. Normally thats null culture InformationManager.DisplayMessage(new InformationMessage("DEFAULT CULTURE USED")); } CustomClan clan = new CustomClan("Bandit Clan", "Bandits", banditCulture); // creates custom clan, initializes it in custom clans constructor //clan.AddClan(game); // Still causes Crashes //hero = game.ObjectManager.RegisterPresumedObject<Hero>(new Hero()); // Causes crashes, I don't think I can do this // CharacterObject lord creates a character object that a hero can be made from. // Currently it uses the Occupation.Wanderer template, we will need to make new template for thsi CharacterObject lord = (from x in CharacterObject.Templates where x.Occupation == Occupation.Wanderer select x).GetRandomElement <CharacterObject>(); // changes the lords name lord.Name = new TextObject("Bandit Lord Test", null); // Changes the lords culture lord.Culture = banditCulture; // creates a hero from the characterObject template. // TODO Change clan add to HeroCreator field Hero hero = HeroCreator.CreateSpecialHero(lord, null, null, null, -1); //GiveGoldAction.ApplyBetweenCharacters(null, hero, 20000, true); // add later hero.Clan = clan.getClan(); // gives the hero the new clan // initializes and creates a kingdom using my custom kingdom class CustomKingdom kingdom = new CustomKingdom("Vagabond Kingdom", "Vagabond", banditCulture); // makes heroes clan join the faction hero.Clan.ClanJoinFaction(kingdom.getKingdom()); //hero.ChangeState(Hero.CharacterStates.Active); // not sure what this does //AddCompanionAction.Apply(Clan.PlayerClan, hero); // Adds this hero to players clan //AddHeroToPartyAction.Apply(hero, MobileParty.MainParty, true); // use this to test if method works //CampaignEventDispatcher.Instance.OnHeroCreated(hero, false); // I believe this crashes return(hero); }
/// <summary> /// Save the object's XML to the XmlWriter. /// </summary> /// <param name="objWriter">XmlTextWriter to write with.</param> public void Save(XmlTextWriter objWriter) { objWriter.WriteStartElement("power"); objWriter.WriteElementString("id", _sourceID.ToString()); objWriter.WriteElementString("guid", _guiID.ToString()); objWriter.WriteElementString("name", Name); objWriter.WriteElementString("extra", Extra); objWriter.WriteElementString("pointsperlevel", _strPointsPerLevel); objWriter.WriteElementString("adeptway", _strAdeptWayDiscount); objWriter.WriteElementString("action", _strAction); objWriter.WriteElementString("rating", Rating.ToString()); objWriter.WriteElementString("extrapointcost", _decExtraPointCost.ToString(CultureInfo.InvariantCulture)); objWriter.WriteElementString("levels", LevelsEnabled.ToString()); objWriter.WriteElementString("maxlevel", _intMaxLevel.ToString(CultureInfo.InvariantCulture)); objWriter.WriteElementString("discounted", _blnDiscountedAdeptWay.ToString()); objWriter.WriteElementString("discountedgeas", _blnDiscountedGeas.ToString()); objWriter.WriteElementString("bonussource", _strBonusSource); objWriter.WriteElementString("freepoints", _decFreePoints.ToString(CultureInfo.InvariantCulture)); objWriter.WriteElementString("source", _strSource); objWriter.WriteElementString("page", _strPage); objWriter.WriteElementString("free", _blnFree.ToString()); objWriter.WriteElementString("freelevels", _intFreeLevels.ToString(CultureInfo.InvariantCulture)); if (Bonus != null) { objWriter.WriteRaw("<bonus>" + Bonus.InnerXml + "</bonus>"); } else { objWriter.WriteElementString("bonus", string.Empty); } if (_nodAdeptWayRequirements != null) { objWriter.WriteRaw("<adeptwayrequires>" + _nodAdeptWayRequirements.InnerXml + "</adeptwayrequires>"); } else { objWriter.WriteElementString("adeptwayrequires", string.Empty); } objWriter.WriteStartElement("enhancements"); foreach (Enhancement objEnhancement in Enhancements) { objEnhancement.Save(objWriter); } objWriter.WriteEndElement(); objWriter.WriteElementString("notes", _strNotes); objWriter.WriteEndElement(); CharacterObject.SourceProcess(_strSource); }
public static void HandleCharEnum(ref PacketReader packet, ref WorldManager manager) { var account = manager.account; var result = CharacterObject.GetCharactersByAccount(account); PacketWriter writer = new PacketWriter(Opcodes.SMSG_CHAR_ENUM); writer.WriteUInt8((byte)result.Length); foreach (Character c in result) { writer.WriteUInt64(c.Guid); Console.WriteLine("GUID: {0}", c.Guid); writer.WriteString(c.Name); writer.WriteUInt8(c.Race); writer.WriteUInt8(c.Class); writer.WriteUInt8(c.Gender); writer.WriteUInt8(c.Skin); writer.WriteUInt8(c.Face); writer.WriteUInt8(c.HairStyle); writer.WriteUInt8(c.HairStyle); writer.WriteUInt8(c.FacialHair); writer.WriteUInt8(c.Level); writer.WriteUInt32(c.Zone); writer.WriteUInt32(c.Map); writer.WriteFloat(c.X); writer.WriteFloat(c.Y); writer.WriteFloat(c.Z); writer.WriteUInt32(c.GuildGuid); writer.WriteUInt32(c.PetDisplayInfo); writer.WriteUInt32(c.PetLevel); writer.WriteUInt32(c.PetFamily); // Not implented for (int j = 0; j < 20; j++) { writer.WriteUInt32(0); // DisplayId writer.WriteUInt8(0); // InventoryType } } manager.Send(writer); }
private void onPlayerDisconnect(PlayerDisconnectedEvent evnt) { if (players.ContainsKey(evnt.playerDisconnectedId)) { Debug.Log("onPlayerDisconnect"); Player player = players[evnt.playerDisconnectedId]; Debug.Log("Player " + player.username + " (" + player.id + ") disconnected."); players.Remove(player.id); if (player.character != null && characters.ContainsKey(player.character.id)) { CharacterObject character = characters[player.character.id]; character.Destroy(); characters.Remove(character.id); } } }
// Use this for initialization void Start() { bulletRB = GetComponent <Rigidbody2D>(); controller = GetComponent <Controller2D>(); if (bulletType != 0) { target = GameEngine.gameEngine.mainCharacter; targetPos = target.transform.position; moveDirection = (targetPos - transform.position).normalized * speed; } //audioManager = AudioManager.instance; //if (audioManager == null) //{ // Debug.LogError("No Audio Manager in Scene"); //} }
private bool canFireCheck(CharacterObject currentPlayer) { // Now we need to get the parent of the gun -> whether the parent is player 1 or player 2 string match1 = FindParentWithTag("Player", this.transform).name; // This gets the current charater name invoking the script string match2 = currentPlayer.charObject.transform.name; // Fire only when both are originating from the same object if (match1 != null && match1 == match2) { return(true); } return(false); }
private static void Postfix(CharacterObject __instance, BodyProperties properties, bool isFemale) { if (__instance.IsHero) { PropertyInfo staticBodyPropertyInfoOnHero = AccessTools.Property(typeof(Hero), "StaticBodyProperties"); staticBodyPropertyInfoOnHero.SetValue(__instance.HeroObject, properties.StaticProperties); __instance.HeroObject.Weight = properties.Weight; __instance.HeroObject.Build = properties.Build; __instance.HeroObject.UpdatePlayerGender(isFemale); } if (__instance.IsHero && __instance.HeroObject.IsHumanPlayerCharacter && DCCSettingsUtil.Instance.DebugMode) { InformationManager.DisplayMessage(new InformationMessage(HeroUpdatedMsg.ToString() + __instance.HeroObject.Name, ColorManager.Purple)); } }
protected void Page_Load(object sender, EventArgs e) { if (Session["Results"] == null || Session["Opponent"] == null) { Response.Redirect("~/Default.aspx"); } if (Session["User"] == null) { Session["ErrorMessage"] = "You need to be logged in first"; Response.Redirect("~/Login.aspx"); } UserObject user = (UserObject)Session["User"]; if (user.character == null) { Session["ErrorMessage"] = "You need to have a card character before battling."; Response.Redirect("~/CreateAChar.aspx"); } self = (CharacterObject)user.character; opponent = (CharacterObject)Session["Opponent"]; lblDamage.Text = "Damage Dealt: " + Session["Damage"].ToString(); Session.Remove("Damage"); imgSelf.ImageUrl = self.ImageUrl; imgOther.ImageUrl = opponent.ImageUrl; bool victory = (bool)Session["Results"]; if (victory) { imgSelf.CssClass = imgSelf.CssClass + " victor"; imgOther.CssClass = imgOther.CssClass + " loser"; giveRewards(user.userId.Value, opponent.Reward); lblMessage.Text = "<p>You have won this battle and earned " + opponent.Reward + "points.</p>"; user.points += opponent.Reward; } else { imgSelf.CssClass = imgSelf.CssClass + " loser"; imgOther.CssClass = imgOther.CssClass + " victor"; lblMessage.Text = "<p>Loss! The opponent was just too strong.</p>"; } Session.Remove("Results"); Session.Remove("Opponent"); }
/** * User can provide query param (charID) to look at the Character. * If not provided, it will show the user's Character * If user has no Character, kick to create a char page. */ protected void Page_Load(object sender, EventArgs e) { if (Session["User"] == null) { Session["ErrorMessage"] = "You need to be logged in first"; Response.Redirect("~/Login.aspx"); } int cId; bool querySucc = int.TryParse(Request.QueryString["charID"], out cId); if (querySucc) { character = dataController.getCharacterByCharId(cId); } else { UserObject user = (UserObject)Session["User"]; if (user.character == null) { Session["ErrorMessage"] = "You can create a Card Character here first before viewing it."; Response.Redirect("~/CreateAChar.aspx"); } else { character = user.character; } } if (character == null) { noCharFoundPanel.Visible = true; viewPanel.Visible = false; } else { noCharFoundPanel.Visible = false; viewPanel.Visible = true; imgAvatar.ImageUrl = character.ImageUrl; } }
/// <summary> /// Initializes a new instance of the <see cref="IObject"/> class. /// </summary> /// <param name="Material">The material.</param> /// <param name="Modelo">The modelo.</param> /// <param name="PhysicObject">The physic object.</param> public ISpriteObject(IMaterial Material, SpriteAnimated Modelo, CharacterObject PhysicObject, float animationSpeed = 20) { System.Diagnostics.Debug.Assert(Modelo != null); System.Diagnostics.Debug.Assert(Material != null); System.Diagnostics.Debug.Assert(PhysicObject != null); this.CharacterObject = PhysicObject; this.Material = Material; this.Modelo = null; this.SpriteAnimated = Modelo; this.PhysicObject = PhysicObject; IObjectAttachment = new List<IObjectAttachment>(); Name = null; TaskResult = BehaviorTrees.TaskResult.Success; anims = new String[Modelo.NumberAnimations]; for (int i = 0; i < Modelo.NumberAnimations ; i++) { String name = i.ToString(); SpriteAnimated.AddAnimation(name, i + 1, Modelo.Frame, 0, true, animationSpeed); anims[i] = name; } }
private void showTrainingPanel(DateTime trainingTime, CharacterObject.trainingTypeEnum type) { litTrainingTitle.Text = "Training In Progress"; trainingPanel.Visible = true; shopPanel.Visible = false; finishTime = trainingTime; if (type == CharacterObject.trainingTypeEnum.Attack) { trainingImgIcon.ImageUrl = "~/images/Attack-Icon.png"; } else if (type == CharacterObject.trainingTypeEnum.Health) { trainingImgIcon.ImageUrl = "~/images/HP-Icon.png"; } else if (type == CharacterObject.trainingTypeEnum.Speed) { trainingImgIcon.ImageUrl = "~/images/Speed-Icon.png"; } lblTraining.Text = lblTraining.Text = "Training Type: " + type.ToString(); }
public void Load(string filePath) { var fh = new FileHandler(filePath, FileHandler.FileOpenMode.Reading, Encoding.UTF8); short skeletonFileCount = fh.Read<short>(); for (int i = 0; i < skeletonFileCount; i++) { string skeletonFile = fh.Read<ZString>(); SkeletonFiles.Add(skeletonFile); } short motionFileCount = fh.Read<short>(); for (int i = 0; i < motionFileCount; i++) { string motionFile = fh.Read<ZString>(); MotionFiles.Add(motionFile); } short effectFileCount = fh.Read<short>(); for (int i = 0; i < effectFileCount; i++) { string effectFile = fh.Read<ZString>(); EffectFiles.Add(effectFile); } short characterCount = fh.Read<short>(); for (int i = 0; i < characterCount; i++) { Character character = new Character(); character.IsEnabled = fh.Read<char>() != 0; if (character.IsEnabled) { character.ID = fh.Read<short>(); character.Name = fh.Read<ZString>(); short objectCount = fh.Read<short>(); for (int j = 0; j < objectCount; j++) { CharacterObject @object = new CharacterObject(); @object.Object = fh.Read<short>(); character.Objects.Add(@object); } short animationCount = fh.Read<short>(); for (int j = 0; j < animationCount; j++) { CharacterAnimation animation = new CharacterAnimation(); animation.Type = (AnimationType)fh.Read<short>(); animation.Animation = fh.Read<short>(); character.Animations.Add(animation); } short effectCount = fh.Read<short>(); for (int j = 0; j < effectCount; j++) { CharacterEffect effect = new CharacterEffect(); effect.Bone = fh.Read<short>(); effect.Effect = fh.Read<short>(); character.Effects.Add(effect); } } Characters.Add(character); } }
public void SpellAttack(Character attacker, Character defender, CharacterObject.HitType hitType, float attackRange, int damage) { if (defender == null || Vector3.Distance(attacker.WorldObject.transform.position, defender.WorldObject.transform.position) > attackRange) return; if (UnityEngine.Random.value <= defender.DodgeBonus) return; float armorParam = 1; if (defender.ArmorValue > 0) armorParam = Mathf.Min(damage / defender.ArmorValue, 1.0f); damage = (int)(damage * armorParam); defender.TakeDamage(damage, hitType); if (defender.Damage >= defender.HitPoints) attacker.XP += defender.XP; }
public void AddToList(CharacterObject element) { characterList.Add(element); if (characterList.Count == 1) CurrentTurn = characterList[0]; }
/// <summary> Distances.</summary> /// /// <param name="target"> Target for the.</param> /// <param name="source"> Source for the.</param> /// /// <returns> .</returns> private int Distance(CharacterObject target, CharacterObject source) { int disx = source.PosX - target.PosX; int disy = source.PosY - target.PosY; if (disx < 0) disx = disx * -1; if (disy < 0) disy = disy * -1; int dis = disx + disy; return dis; }
/// <summary> /// Load content for the screen. /// </summary> /// <param name="GraphicInfo"></param> /// <param name="factory"></param> /// <param name="contentManager"></param> protected override void LoadContent(PloobsEngine.Engine.GraphicInfo GraphicInfo, PloobsEngine.Engine.GraphicFactory factory, IContentManager contentManager) { ///must be called before all base.LoadContent(GraphicInfo, factory, contentManager); ///Uncoment to Add an object /////Create a simple object /////Geomtric Info and textures (this model automaticaly loads the texture) //SimpleModel simpleModel = new SimpleModel(factory, "Model FILEPATH GOES HERE", "Diffuse Texture FILEPATH GOES HERE -- Use only if it is not embeded in the Model file"); /////Physic info (position, rotation and scale are set here) //TriangleMeshObject tmesh = new TriangleMeshObject(simpleModel, Vector3.Zero, Matrix.Identity, Vector3.One, MaterialDescription.DefaultBepuMaterial()); /////Shader info (must be a deferred type) //DeferredNormalShader shader = new DeferredNormalShader(); /////Material info (must be a deferred type also) //DeferredMaterial fmaterial = new DeferredMaterial(shader); /////The object itself //IObject obj = new IObject(fmaterial, simpleModel, tmesh); /////Add to the world //this.World.AddObject(obj); { SimpleModel simpleModel = new SimpleModel(factory, "Model//block"); simpleModel.SetTexture(factory.CreateTexture2DColor(1, 1, Color.Red), TextureType.DIFFUSE); BoxObject tmesh = new BoxObject(Vector3.Zero, 1, 1, 1, 10, new Vector3(500, 5, 500), Matrix.Identity, MaterialDescription.DefaultBepuMaterial()); tmesh.isMotionLess = true; ForwardXNABasicShader shader = new ForwardXNABasicShader(ForwardXNABasicShaderDescription.Default()); ForwardMaterial fmaterial = new ForwardMaterial(shader); IObject obj = new IObject(fmaterial, simpleModel, tmesh); this.World.AddObject(obj); } { SimpleModel simpleModel = new SimpleModel(factory, "Model//block"); simpleModel.SetTexture(factory.CreateTexture2DColor(1, 1, Color.Yellow), TextureType.DIFFUSE); GhostObject go = new GhostObject(Vector3.Zero, Matrix.Identity, new Vector3(1, 100, 1)); ForwardXNABasicShader shader = new ForwardXNABasicShader(ForwardXNABasicShaderDescription.Default()); ForwardMaterial fmaterial = new ForwardMaterial(shader); BaseObject obj = new BaseObject(fmaterial, simpleModel, go); obj.Name = "TORRE1"; this.World.AddObject(obj); //entityFactory.CreateShooterTower(obj, 3, 2, 100); } { Texture2D tex = factory.GetTexture2D("Textures//spriteteste"); SpriteAnimated SpriteAnimated = new PloobsEngine.Modelo2D.SpriteAnimated(tex, 9, 8); SpriteAnimated.PlayCurrentAnimation(); CharacterObject Characterobj = new CharacterObject(new Vector3(25, 15, 25), Matrix.Identity, 10, 5, 10, 1f, Vector3.One, 5); Sprite3DShader Sprite3DShader = new Sprite3DShader(Vector2.One); ForwardMaterial fmaterial = new ForwardMaterial(Sprite3DShader); ISpriteObject obj = new ISpriteObject(fmaterial, SpriteAnimated, Characterobj); obj.Name = "Enemy"; this.World.AddObject(obj); obj.OnUpdate += new OnUpdate(obj_OnUpdate); } ///Add some directional lights to completely iluminate the world #region Lights DirectionalLightPE ld1 = new DirectionalLightPE(Vector3.Left, Color.White); DirectionalLightPE ld2 = new DirectionalLightPE(Vector3.Right, Color.White); DirectionalLightPE ld3 = new DirectionalLightPE(Vector3.Backward, Color.White); DirectionalLightPE ld4 = new DirectionalLightPE(Vector3.Forward, Color.White); DirectionalLightPE ld5 = new DirectionalLightPE(Vector3.Down, Color.White); float li = 0.4f; ld1.LightIntensity = li; ld2.LightIntensity = li; ld3.LightIntensity = li; ld4.LightIntensity = li; ld5.LightIntensity = li; this.World.AddLight(ld1); this.World.AddLight(ld2); this.World.AddLight(ld3); this.World.AddLight(ld4); this.World.AddLight(ld5); #endregion ///Add a AA post effect this.RenderTechnic.AddPostEffect(new AntiAliasingPostEffect()); ///add a camera this.World.CameraManager.AddCamera(new CameraFirstPerson(GraphicInfo)); }
void Start() { // find objects PauseMenuScript.CharMouseLook = CharacterObject.GetComponent<MouseLook>(); CharacterDO = CharacterObject.GetComponent<CharacterObject>(); CharacterDO.Controller = this; SeedObject.GetComponent<SeedObject>().Controller = this; SeedObject.GetComponentInChildren<SeedUI>().Controller = this; SeedDO = SeedObject.GetComponent<SeedObject>(); ChangeGameState(GameState.Begin); }