public bool CanEquip(ICharacterData character) { return(GetEquipmentItem().CanEquip(character, level)); }
public static KeyValuePair <DamageElement, MinMaxFloat> GetDamageAmount(this Item weaponItem, short level, float rate, ICharacterData character) { if (weaponItem == null || !weaponItem.IsWeapon()) { return(new KeyValuePair <DamageElement, MinMaxFloat>()); } return(GameDataHelpers.MakeDamageAmountPair(weaponItem.damageAmount, level, rate, weaponItem.GetEffectivenessDamage(character))); }
public virtual string Text(ICharacterData text) { return(HtmlMarkupFormatter.Instance.Text(text)); }
void OnSetData(ICharacterData data) => SetText(GetText());
public CharacterRow Parse(ICharacterData data, CharacterRow character, in Segment <string> languages, int row)
String IMarkupFormatter.Text(ICharacterData text) { var content = text.Data; return(EscapeText(content)); }
public static Dictionary <DamageElement, MinMaxFloat> GetEquipmentIncreaseDamages(this ICharacterData data) { if (data == null) { return(new Dictionary <DamageElement, MinMaxFloat>()); } var result = new Dictionary <DamageElement, MinMaxFloat>(); // Armors Item tempEquipment = null; var equipItems = data.EquipItems; foreach (var equipItem in equipItems) { tempEquipment = equipItem.GetEquipmentItem(); if (tempEquipment != null) { result = GameDataHelpers.CombineDamageAmountsDictionary(result, tempEquipment.GetIncreaseDamages(equipItem.level, equipItem.GetEquipmentBonusRate())); } } // Weapons var equipWeapons = data.EquipWeapons; // Right hand equipment var rightHandItem = equipWeapons.rightHand; tempEquipment = rightHandItem.GetEquipmentItem(); if (tempEquipment != null) { result = GameDataHelpers.CombineDamageAmountsDictionary(result, tempEquipment.GetIncreaseDamages(rightHandItem.level, rightHandItem.GetEquipmentBonusRate())); } // Left hand equipment var leftHandItem = equipWeapons.leftHand; tempEquipment = leftHandItem.GetEquipmentItem(); if (tempEquipment != null) { result = GameDataHelpers.CombineDamageAmountsDictionary(result, tempEquipment.GetIncreaseDamages(leftHandItem.level, leftHandItem.GetEquipmentBonusRate())); } return(result); }
//---------------------------------------------------------------------------------------------------------- #region Spawn public void DoSpawn(int amount, ICharacterData data, IEffectable source) => SpawnMechanics.DoSpawn(amount, data, source);
public bool CanUse(ICharacterData character) { return(GetSkill().CanUse(character, level)); }
public string LiteralText(ICharacterData text) { throw new System.NotImplementedException(); }
public void Setup(CharacterItemLevelTuple data, ICharacterData character, int indexOfData, string equipPosition) { this.equipPosition = equipPosition; Setup(data, character, indexOfData); }
public string Text(ICharacterData text) => _formatter.Text(text);
public virtual void Setup(T data, ICharacterData character, int indexOfData) { Character = character; IndexOfData = indexOfData; Data = data; }
public StatsController(ICharacterData characterData, DamageService damageService) { _characterData = characterData; _damageService = damageService; }
public static bool IncreaseItems(this ICharacterData data, int dataId, short level, short amount) { Item itemData; // If item not valid if (amount <= 0 || !GameInstance.Items.TryGetValue(dataId, out itemData)) { return(false); } var maxStack = itemData.maxStack; var emptySlots = new Dictionary <int, CharacterItem>(); var changes = new Dictionary <int, CharacterItem>(); // Loop to all slots to add amount to any slots that item amount not max in stack for (var i = 0; i < data.NonEquipItems.Count; ++i) { var nonEquipItem = data.NonEquipItems[i]; if (!nonEquipItem.IsValid()) { // If current entry is not valid, add it to empty list, going to replacing it later emptySlots[i] = nonEquipItem; } else if (nonEquipItem.dataId == dataId) { // If same item id, increase its amount if (nonEquipItem.amount + amount <= maxStack) { nonEquipItem.amount += amount; changes[i] = nonEquipItem; amount = 0; break; } else if (maxStack - nonEquipItem.amount > 0) { amount = (short)(maxStack - (maxStack - nonEquipItem.amount)); nonEquipItem.amount = maxStack; changes[i] = nonEquipItem; } } } if (changes.Count == 0 && emptySlots.Count > 0) { // If there are no changes and there are an empty entries, fill them foreach (var emptySlot in emptySlots) { var value = emptySlot.Value; var newItem = CharacterItem.Create(dataId, level); short addAmount = 0; if (amount - maxStack >= 0) { addAmount = maxStack; amount -= maxStack; } else { addAmount = amount; amount = 0; } newItem.amount = addAmount; changes[emptySlot.Key] = newItem; } } // Apply all changes foreach (var change in changes) { data.NonEquipItems[change.Key] = change.Value; } // Add new items while (amount > 0) { var newItem = CharacterItem.Create(dataId, level); short addAmount = 0; if (amount - maxStack >= 0) { addAmount = maxStack; amount -= maxStack; } else { addAmount = amount; amount = 0; } newItem.amount = addAmount; data.NonEquipItems.Add(newItem); } return(true); }
/// <inheritdoc /> public virtual String Text(ICharacterData text) => EscapeText(text.Data);
public static bool DecreaseItems(this ICharacterData data, int dataId, short amount) { Dictionary <CharacterItem, short> decreaseItems; return(DecreaseItems(data, dataId, amount, out decreaseItems)); }
private static Boolean EndsWithSpace(ICharacterData text) { var content = text.Data; return(content.Length > 0 && content[content.Length - 1].IsSpaceCharacter()); }
public static bool DecreaseAmmos(this ICharacterData data, AmmoType ammoType, short amount) { Dictionary <CharacterItem, short> decreaseItems; return(DecreaseAmmos(data, ammoType, amount, out decreaseItems)); }
public abstract float GetTotalWeight(ICharacterData character);
/// <summary> /// Formats the given text. /// </summary> /// <param name="text">The text to sanatize.</param> /// <returns>The formatted text.</returns> public String Text(ICharacterData text) { return(ChildFormatter.Text(text)); }
public void Update(Guid characterId, ICharacterData characterData) { if (characterId.IsEmpty()) throw new ArgumentException("characterId"); if (characterData == null) throw new ArgumentNullException("characterData"); throw new NotImplementedException(); }
void OnSetData(ICharacterData data) => SetTexture(data.Artwork);
string IMarkupFormatter.LiteralText(ICharacterData text) => string.Empty;
public static KeyValuePair <DamageElement, MinMaxFloat> GetDamageAmount(this Skill skill, short level, ICharacterData character) { if (!skill.IsAttack() || skill.skillAttackType != SkillAttackType.Normal) { return(new KeyValuePair <DamageElement, MinMaxFloat>()); } return(GameDataHelpers.MakeDamage(skill.damageAmount, level, 1f, skill.GetEffectivenessDamage(character))); }
String IMarkupFormatter.Text(ICharacterData text) { return(text.Data); }
public static bool CanUse(this Skill skill, ICharacterData character, short level) { if (skill == null || character == null) { return(false); } bool available = true; switch (skill.skillType) { case SkillType.Active: WeaponType[] availableWeapons = skill.availableWeapons; available = availableWeapons == null || availableWeapons.Length == 0; if (!available) { Item rightWeaponItem = character.EquipWeapons.rightHand.GetWeaponItem(); Item leftWeaponItem = character.EquipWeapons.leftHand.GetWeaponItem(); foreach (WeaponType availableWeapon in availableWeapons) { if (rightWeaponItem != null && rightWeaponItem.WeaponType == availableWeapon) { available = true; break; } else if (leftWeaponItem != null && leftWeaponItem.WeaponType == availableWeapon) { available = true; break; } else if (rightWeaponItem == null && leftWeaponItem == null && GameInstance.Singleton.DefaultWeaponItem.WeaponType == availableWeapon) { available = true; break; } } } break; case SkillType.CraftItem: if (!(character is BasePlayerCharacterEntity) || !skill.itemCraft.CanCraft(character as BasePlayerCharacterEntity)) { return(false); } break; default: return(false); } if (level <= 0) { return(false); } if (!available) { return(false); } if (character.CurrentMp < skill.GetConsumeMp(level)) { return(false); } int skillUsageIndex = character.IndexOfSkillUsage(skill.DataId, SkillUsageType.Skill); if (skillUsageIndex >= 0 && character.SkillUsages[skillUsageIndex].coolDownRemainsDuration > 0f) { return(false); } return(true); }
public RuntimeCharacter(ICharacterData characterData, IPlayer player) => SetData(characterData, player);
/// <inheritdoc /> public virtual String LiteralText(ICharacterData text) => text.Data;
public static Dictionary <DamageElement, MinMaxFloat> GetDamageAmountWithInflictions(this Item weaponItem, short level, float rate, ICharacterData character, Dictionary <DamageElement, float> damageInflictionAmounts) { if (weaponItem == null || !weaponItem.IsWeapon()) { return(new Dictionary <DamageElement, MinMaxFloat>()); } return(GameDataHelpers.MakeDamageAmountWithInflictions(weaponItem.damageAmount, level, rate, weaponItem.GetEffectivenessDamage(character), damageInflictionAmounts)); }
public override void Setup(CharacterSummon data, ICharacterData character, int indexOfData) { base.Setup(data, character, indexOfData); ClearStackingEntries(); }