Exemple #1
0
        public MCharacter Clone()
        {
            MCharacter mCharacter = new MCharacter();

            mCharacter.characterId = characterId;
            return(mCharacter);
        }
Exemple #2
0
        public static MCharacterAbility Create(MCharacter mCharacter)
        {
            MCharacterAbility ability = new MCharacterAbility();

            ability.Update(mCharacter);
            return(ability);
        }
Exemple #3
0
        public static MCharacter Create(Master.MNpc npc)
        {
            MCharacter mCharacter = new MCharacter();

            mCharacter.id          = npc.id;
            mCharacter.characterId = npc.character_id;
            mCharacter.horse       = npc.horse;
            mCharacter.clothes     = npc.clothes;
            mCharacter.weapon      = npc.weapon;
            mCharacter.star        = npc.star;
            mCharacter.action      = ActionType.idle;
            return(mCharacter);
        }
Exemple #4
0
        public void Update(MCharacter mCharacter)
        {
            Master.MCharacter master = mCharacter.master;
            if (master == null)
            {
                return;
            }
            MSkill[] skills = mCharacter.skills;
            this.power            = master.power;
            this.knowledge        = master.knowledge;
            this.speed            = master.speed;
            this.trick            = master.trick;
            this.endurance        = master.endurance;
            this.movingPower      = master.movingPower;
            this.riding           = master.riding;
            this.walker           = master.walker;
            this.pike             = master.pike;
            this.sword            = master.sword;
            this.longKnife        = master.longKnife;
            this.knife            = master.knife;
            this.longAx           = master.longAx;
            this.ax               = master.ax;
            this.longSticks       = master.longSticks;
            this.sticks           = master.sticks;
            this.archery          = master.archery;
            this.hiddenWeapons    = master.hiddenWeapons;
            this.dualWield        = master.dualWield;
            this.resistanceMetal += master.resistanceMetal;
            this.resistanceWood  += master.resistanceWood;
            this.resistanceWater += master.resistanceWater;
            this.resistanceFire  += master.resistanceFire;
            this.resistanceEarth += master.resistanceEarth;
            int hp = master.hp;
            int mp = master.mp;

            if (skills != null)
            {
                foreach (MSkill skill in skills)
                {
                    Master.MSkill skillMaster = skill.master;
                    if (skillMaster == null)
                    {
                        return;
                    }
                    if (!System.Array.Exists(skillMaster.types, s => s == SkillType.ability))
                    {
                        continue;
                    }
                    hp += skillMaster.hp;
                    mp += skillMaster.mp;
                    this.CountCharacterParams(skillMaster);
                }
            }
            List <MEquipment> equipments = new List <MEquipment>();

            if (mCharacter.weapon > 0)
            {
                equipments.Add(mCharacter.equipmentWepon);
            }
            if (mCharacter.clothes > 0)
            {
                equipments.Add(mCharacter.equipmentClothes);
            }
            if (mCharacter.horse > 0)
            {
                equipments.Add(mCharacter.equipmentHorse);
            }
            physicalAttack  = 0;
            physicalDefense = 0;
            magicAttack     = 0;
            magicDefense    = 0;
            foreach (MEquipment equipment in equipments)
            {
                hp                   += equipment.hp;
                mp                   += equipment.mp;
                this.power           += equipment.power;
                this.knowledge       += equipment.knowledge;
                this.speed           += equipment.speed;
                this.trick           += equipment.trick;
                this.endurance       += equipment.endurance;
                this.movingPower     += equipment.movingPower;
                this.riding          += equipment.riding;
                this.walker          += equipment.walker;
                this.pike            += equipment.pike;
                this.sword           += equipment.sword;
                this.longKnife       += equipment.longKnife;
                this.knife           += equipment.knife;
                this.longAx          += equipment.longAx;
                this.ax              += equipment.ax;
                this.longSticks      += equipment.longSticks;
                this.sticks          += equipment.sticks;
                this.archery         += equipment.archery;
                this.hiddenWeapons   += equipment.hiddenWeapons;
                this.dualWield       += equipment.dualWield;
                this.magic           += equipment.magic;
                this.resistanceMetal += equipment.resistanceMetal;
                this.resistanceWood  += equipment.resistanceWood;
                this.resistanceWater += equipment.resistanceWater;
                this.resistanceFire  += equipment.resistanceFire;
                this.resistanceEarth += equipment.resistanceEarth;
                physicalAttack       += equipment.physicalAttack;
                physicalDefense      += equipment.physicalDefense;
                magicAttack          += equipment.magicAttack;
                magicDefense         += equipment.magicDefense;
            }

            this.hpMax = Mathf.FloorToInt(mCharacter.level * (10 + this.endurance * 0.2f) + hp);
            this.mpMax = Mathf.FloorToInt(mCharacter.level * (5 + this.knowledge * 0.1f) + mp);
            float moveTypeValue = (mCharacter.moveType == MoveType.cavalry ? this.riding : this.walker);

            switch (mCharacter.weaponType)
            {
            case WeaponType.archery:
                moveTypeValue += this.archery;
                break;

            case WeaponType.pike:
                moveTypeValue += this.pike;
                break;

            case WeaponType.sword:
                moveTypeValue += this.sword;
                break;

            case WeaponType.longAx:
                moveTypeValue += this.longAx;
                break;

            case WeaponType.ax:
                moveTypeValue += this.ax;
                break;

            case WeaponType.longKnife:
                moveTypeValue += this.longKnife;
                break;

            case WeaponType.shortKnife:
                moveTypeValue += this.knife;
                break;

            case WeaponType.longSticks:
                moveTypeValue += this.longSticks;
                break;

            case WeaponType.sticks:
                moveTypeValue += this.sticks;
                break;

            case WeaponType.dualWield:
                moveTypeValue += this.dualWield;
                break;

            case WeaponType.magic:
                moveTypeValue += this.magic;
                break;
            }
            float starPower = 0.7f + mCharacter.star * 0.06f;

            this.physicalAttack   = Mathf.FloorToInt((this.power + this.knowledge) * 0.3f + (this.power * 2f + this.knowledge) * (0.4f + (moveTypeValue * 0.5f) * 0.006f) * (1f + mCharacter.level * starPower * 0.5f) * 0.1f);
            this.physicalAttack  += physicalAttack;
            this.magicAttack      = Mathf.FloorToInt((this.trick + this.knowledge) * 0.3f + (this.trick * 2f + this.knowledge) * (0.4f + (moveTypeValue * 0.5f) * 0.006f) * (1f + mCharacter.level * starPower * 0.5f) * 0.1f);
            this.magicAttack     += magicAttack;
            this.physicalDefense  = Mathf.FloorToInt((this.power * 0.5f + this.knowledge) * 0.3f + (this.power + this.knowledge) * (1f + mCharacter.level * starPower * 0.5f) * 0.04f);
            this.physicalDefense += physicalDefense;
            this.magicDefense     = Mathf.FloorToInt((this.trick * 0.5f + this.knowledge) * 0.3f + (this.trick + this.knowledge) * (1f + mCharacter.level * starPower * 0.5f) * 0.04f);
            this.magicDefense    += magicDefense;


            this.hpMax *= 3;
            this.mpMax *= 3;
        }