Skip to content

Instantly share code, notes, and snippets.

@fusspawn
Created October 30, 2018 22:27
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save fusspawn/fccc77d171995c415f779781953ef156 to your computer and use it in GitHub Desktop.
Save fusspawn/fccc77d171995c415f779781953ef156 to your computer and use it in GitHub Desktop.
using Game;
using GV;
using System;
using System.Collections.Generic;
using UnityEngine;
[Serializable]
public class MobStats
{
[SerializeField]
public string MobNameEN;
public int MobIDDebug;
[SerializeField]
public ushort MobId;
[SerializeField]
public string MobNameTranslated;
[SerializeField]
public byte MobLvl;
[SerializeField]
public uint MobMaxHP;
[SerializeField]
private int _currentHP;
public float BaseHPRegen;
public float ArmorPenetration;
public ushort SlashingDamage;
public ushort PiercingDamage;
public ushort BludgeonDamage;
public ushort DefenseSlashing;
public ushort DefensePiercing;
public ushort DefenseBludgeon;
public ushort Experience;
public uint MinGold;
public uint MaxGold;
public byte MaxLootAmount;
public MaterialTypes MobDamageTypeSounds;
public MobGroup MobGroup;
public List<LootGroup> LootGroupList;
public int CurrentHP
{
get
{
return this._currentHP;
}
set
{
this._currentHP = value;
}
}
public float DefenseGeneral
{
get
{
return (float)(this.DefenseSlashing + this.DefenseBludgeon + this.DefensePiercing) / 3f;
}
}
public float HPRegen
{
get
{
return this.BaseHPRegen;
}
}
public string Name
{
get
{
return LanguageManager.getTranslation(this.MobNameTranslated);
}
}
public ushort SummaryDamage
{
get
{
return (ushort)(this.SlashingDamage + this.PiercingDamage + this.BludgeonDamage);
}
}
public MobStats(Mob mob, List<LootGroup> lootGroupList)
{
this.MobId = mob.Mob_Id;
this.MobIDDebug = this.MobId;
this.MobNameTranslated = mob.Mob_MobName;
this.MobNameEN = mob.Mob_NameEN;
this.MobLvl = (byte)mob.Mob_Lvl;
this.MobMaxHP = mob.Mob_Hp;
this.ArmorPenetration = mob.MobAttack_ArmorPenetration;
this.SlashingDamage = (ushort)mob.MobDamage_SlashingDamage;
this.PiercingDamage = (ushort)mob.MobDamage_PiercingDamage;
this.BludgeonDamage = (ushort)mob.MobDamage_BludgeonDamage;
this.DefenseSlashing = mob.MobDefense_DefenseSlashingDamage;
this.DefensePiercing = mob.MobDefense_DefensePiercingDamage;
this.DefenseBludgeon = mob.MobDefense_DefenseBludgeonDamage;
this.Experience = (ushort)mob.MobLoot_Exp;
this.MinGold = mob.MobLoot_MinCoins;
this.MaxGold = mob.MobLoot_MaxCoins;
this.MaxLootAmount = (byte)mob.MobLoot_MaxLootAmount;
this.LootGroupList = lootGroupList;
this.MobDamageTypeSounds = this.CastMobDamageTypeSoundsToMaterialTypes(mob.Mob_MobsDamageReceivedSound);
this._currentHP = (int)this.MobMaxHP;
this.MobGroup = (MobGroup)((int)mob.Mob_MobGroup);
}
public MobStats(MobStats stats)
{
this.MobId = stats.MobId;
this.MobIDDebug = this.MobId;
this.MobNameTranslated = stats.MobNameTranslated;
this.MobNameEN = stats.MobNameEN;
this.MobLvl = stats.MobLvl;
this.MobMaxHP = stats.MobMaxHP;
this.ArmorPenetration = stats.ArmorPenetration;
this.SlashingDamage = stats.SlashingDamage;
this.PiercingDamage = stats.PiercingDamage;
this.BludgeonDamage = stats.BludgeonDamage;
this.DefenseSlashing = stats.DefenseSlashing;
this.DefensePiercing = stats.DefensePiercing;
this.DefenseBludgeon = stats.DefenseBludgeon;
this.Experience = stats.Experience;
this.MinGold = stats.MinGold;
this.MaxGold = stats.MaxGold;
this.MaxLootAmount = stats.MaxLootAmount;
this.LootGroupList = stats.LootGroupList;
this.MobDamageTypeSounds = stats.MobDamageTypeSounds;
this._currentHP = (int)this.MobMaxHP;
this.MobGroup = stats.MobGroup;
}
private MaterialTypes CastMobDamageTypeSoundsToMaterialTypes(sbyte value)
{
if ((int)value == 0)
{
return MaterialTypes.None;
}
if ((int)value == 1)
{
return MaterialTypes.Cloth;
}
if ((int)value == 2)
{
return MaterialTypes.Skin;
}
if ((int)value == 3)
{
return MaterialTypes.Chainmail;
}
if ((int)value == 4)
{
return MaterialTypes.Metal;
}
if ((int)value == 5)
{
return MaterialTypes.Bone;
}
if ((int)value == 6)
{
return MaterialTypes.Wood;
}
if ((int)value == 7)
{
return MaterialTypes.Stone;
}
return MaterialTypes.None;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment