示例#1
0
 // --- Constructors ---
 public Unit(string pmFirstName, string pmNickname, string pmLastName, GameExt pmGame, Profession pmProf)
     : base(pmGame, pmGame.models.get(pmProf.getUnitModelID()), 16f*Vector3.UnitY)
 {
     if(pmFirstName.Length> 10)
         pmFirstName=	pmFirstName.Substring(0, 10);
     if(pmLastName.Length> 8)
         pmLastName=	pmLastName.Substring(0, 8);
     if(pmNickname.Length> 10)
         pmNickname=	pmNickname.Substring(0, 10);
     firstName=	pmFirstName;
     lastName=	pmLastName;
     nickname=	pmNickname;
     prof=	pmProf;
     color=	game.getColor("black");
     texture=	game.textures.get("unit_uv");
     pos+=	Vector3.UnitY*16f;
     mapPos=	new int[]	{-1, -1};
     isWalkingDone=	false;
     isAttackingDone=	false;
     originalStats=	new int[8];
     battleStats=	new int[8];
     pExp=	0;
     pLevel=	1;
     statEffects=	new List<StatEffect>();
     isAI=	false;
     statVariance=	new BaseStats(
         0, 0, // HP, Mana
         0, 0, // Atk, Def
         0, 0, // Mag, Res
         0, 0 // Spd, Move
     );
 }
示例#2
0
            // --- Inherited Methods ---
            // Called when the unit has taken damage
            public override int onTakeDamage(Profession prof, ref Unit unit, int oldHealth, int newHealth, int amount, ref Unit instigator, ref BattleMap map)
            {
                if(!unit.hasStatEffect("Enraged"))
                    return amount;
                if(Start.rng.Next(0, 10)< 3)
                    instigator.addStatEffect(StatEffect.create(StatusEffect.Enraged, 3), ref map);

                return amount;
            }
示例#3
0
 // Called when the unit has ended it's turn
 public virtual void onEndTurn(Profession prof, ref Unit unit, ref BattleMap map)
 {
 }
示例#4
0
 // Called when the unit has dodged an attack
 public virtual void onDodgedAttack(Profession prof, ref Unit unit, int amount, ref Unit instigator, ref BattleMap map)
 {
 }
示例#5
0
 // Called when the unit has struck a critical
 public virtual int onCriticalHit(Profession prof, ref Unit unit, int victimHP, int amount, ref Unit victim, ref BattleMap map)
 {
     return 2*amount;
 }
示例#6
0
 // Called when the unit has moved on the map
 public virtual void onUnitMove(Profession prof, ref Unit unit, ref int x, ref int y, ref BattleMap map)
 {
 }
示例#7
0
 // Called when the unit has a new stat effect added
 public virtual bool onStatsEffected(Profession prof, bool isEffected, ref Unit unit, ref StatEffect statEffect, ref BattleMap map)
 {
     return isEffected;
 }
示例#8
0
 // Called when the unit has set's off the trap
 public virtual bool onSetOffTrap(Profession prof, ref Unit unit, ref Unit parent, int x, int y, bool canSetOff, ref Trap trap, ref BattleMap map)
 {
     return canSetOff;
 }
示例#9
0
        // Creates a unit, assigning it a level
        public static Unit create(string nickname, GameExt game, Profession prof, byte level, params string[] passives)
        {
            // Variables
            Unit	unit=	new Unit(
                getRandomFirstName(10),
                nickname,
                getRandomLastName(8),
                game,
                prof
            );

            unit.pLevel=	level;
            unit.pExp=	getExpFromLevel(level);
            if(passives!= null && passives.Length> 0)
            {
                unit.removeAllPassives();
                for(int i= 0; i< passives.Length; i++)
                    unit.assignPassive(passives[i]);
            }

            return unit;
        }
示例#10
0
 // --- Inherited Methods ---
 // Called when the unit has moved on the map
 public override void onUnitMove(Profession prof, ref Unit unit, ref int x, ref int y, ref BattleMap map)
 {
     giveBuff(ref unit, ref map);
 }
示例#11
0
 // --- Inherited Methods ---
 // Called when the unit has a new stat effect added
 public override bool onStatsEffected(Profession prof, bool isEffected, ref Unit unit, ref StatEffect statEffect, ref BattleMap map)
 {
     if(statEffect.type== EffectType.Debuff)
     {
         unit.addStatEffect(
             new StatEffect(
                 EffectType.Buff,
                 "Sturdy",
                 "+25% Def",
                 sturdySE,
                 -1
             ),
             ref map
         );
     }
     return isEffected;
 }
示例#12
0
 // Called when the unit's team has its turn reset
 public override void onResetTurn(Profession prof, ref Unit unit, ref BattleMap map)
 {
     giveBuff(ref unit, ref map);
 }
示例#13
0
            // --- Inherited Methods ---
            // Called when the unit has taken damage
            public override int onTakeDamage(Profession prof, ref Unit unit, int oldHealth, int newHealth, int amount, ref Unit instigator, ref BattleMap map)
            {
                if(Start.rng.Next(0, 5)> 2)
                    return amount;

                if(instigator.getAttackPerc()> 0f)
                    return (int)(0.5f*amount);

                return amount;
            }
示例#14
0
 // --- Inherited Methods ---
 // Called to regen the unit's mana
 public override int onRegenMana(Profession prof, ref Unit unit, int amount)
 {
     return 2*amount;
 }
示例#15
0
 // Called when the unit has been removed from the map
 public virtual void onRemoveFromMap(Profession prof, ref Unit unit, ref BattleMap map)
 {
 }
示例#16
0
 // Called when the unit is healing another unit
 public virtual int onHealing(Profession prof, ref Unit unit, int health, int amount, ref Unit target, ref BattleMap map)
 {
     return amount;
 }
示例#17
0
 // Called when the unit is reseting stats for stat effects
 public virtual void onResetStatAffectStats(Profession prof, ref Unit unit, ref BattleMap map)
 {
 }
示例#18
0
 // Called when the stats have been initiated
 public virtual void onInitStats(Profession prof, ref Unit unit, ref int pmHp, ref int pmMana, ref int pmAtk, ref int pmDef, ref int pmMag, ref int pmRes, ref int pmSpd, ref int pmMove)
 {
 }
示例#19
0
 // Called when the unit is being to set down a trap
 public virtual Trap onSetTrap(Profession pref, ref Unit unit, int x, int y, ref Trap trap, ref BattleMap map)
 {
     return trap;
 }
示例#20
0
 // Called when the unit has leveled up!
 public virtual void onLevelUp(Profession prof, ref Unit unit, ref BattleMap map)
 {
 }
示例#21
0
 // Called when the unit has taken damage
 public virtual int onTakeDamage(Profession prof, ref Unit unit, int oldHealth, int newHealth, int amount, ref Unit instigator, ref BattleMap map)
 {
     return amount;
 }
示例#22
0
 // Called when the unit's attack has missed
 public virtual void onMissedAttack(Profession prof, ref Unit unit, int amount, ref Unit victim, ref BattleMap map)
 {
 }
示例#23
0
 // Called when the unit has ended it's attacking cycle
 public virtual void onAttackingDone(Profession prof, ref Unit unit, ref BattleMap map)
 {
 }
示例#24
0
 // Called when the unit has run out of mana
 public virtual void onOutOfMana(Profession prof, ref Unit unit)
 {
 }
示例#25
0
 // Called when the unit is about to deal damage
 public virtual int onDealtDamage(Profession prof, ref Unit unit, int victimHP, int amount, ref Unit victim, ref BattleMap map)
 {
     return amount;
 }
示例#26
0
 // Called before the unit is updating the stat effects to see if it will update
 public virtual bool onPreUpdateStatEffect(Profession prof, ref Unit unit, bool canUpdate, ref StatEffect statEffect, ref BattleMap map)
 {
     return canUpdate;
 }
示例#27
0
 // Called when the unit has just finished with a stat effect
 public virtual void onDoneWithStatEffect(Profession prof, ref Unit unit, ref StatEffect statEffect, ref BattleMap map)
 {
 }
示例#28
0
 // Called to regen the unit's mana
 public virtual int onRegenMana(Profession prof, ref Unit unit, int amount)
 {
     return amount;
 }
示例#29
0
 // Called when the unit has healed
 public virtual int onHeal(Profession prof, ref Unit unit, int hp, int amount, ref Unit instigator, ref BattleMap map)
 {
     return amount;
 }
示例#30
0
 // Called when the unit's attack has missed
 public override void onMissedAttack(Profession prof, ref Unit unit, int amount, ref Unit victim, ref BattleMap map)
 {
     if(!unit.hasStatEffect("Enraged"))
         return;
     if(Start.rng.Next(0, 10)< 3)
         victim.addStatEffect(StatEffect.create(StatusEffect.Enraged, 3), ref map);
 }