Ejemplo n.º 1
0
		public MoveQueueItem(ITMItem aItem,BattleMonsterWithMoves aActionMonster) {
			this._actionMonster = aActionMonster;
			_forcedSpeed = float.MaxValue;
			_useThisMove = null;
			targetTeam = ETeamPosition.RightTeam;
			targetMonster = EMonsterPos.Unset;
			actionPosition = EMonsterPos.Unset;
			usedItem = aItem;
			firstHit = true;
		}
Ejemplo n.º 2
0
		public MoveQueueItem(float aSpeed,SelectedMoveData aMoveData,ETeamPosition aTargetTeam,EMonsterPos aTargetMonster,BattleMonsterWithMoves aActionMonster,EMonsterPos aActionMonsterPosition) {
			_speed = aSpeed;
			_move = aMoveData;
			_actionMonster = aActionMonster;
			targetTeam = aTargetTeam;
			targetMonster = aTargetMonster;
			actionPosition = aActionMonsterPosition;
			// Multi hit moves
			timesToHit = 1;
			firstHit = true;

		}
Ejemplo n.º 3
0
		private void applyHPEffectToMonster(BattleMonsterWithMoves aAttacker,MoveLibItem aMove,float aSplashPercent,BattleMonsterWithMoves aDefending,CommentaryManager aCommentaryManager,EMonsterPos aAttackersPosition) {
			
			//Damage = ((((2 * Level / 5 + 2) * AttackStat * AttackPower / DefenseStat) / 50) + 2) * STAB * Weakness/Resistance * RandomNumber / 100
			
			BattleBase.DebugText("BattleTeamWithMoves->applyHPEffectToMonster");
			PassiveEffect attackersEffect = getAttackHPHitPassiveEffect((BattleMonster) aAttacker,(BattleMonster) aDefending,aMove);
			PassiveEffect defendersEffect = getDefenderHPHitPassiveEffect((BattleMonster) aAttacker,(BattleMonster) aDefending,aMove);
			
			if(CommentaryManager.REF!=null) {
				CommentaryManager.REF.passiveEffect = attackersEffect;
				CommentaryManager.REF.battleMonster = (BattleMonster) aAttacker;
			}
			
			if((int) aMove.powerOnlyIfTheseStatusEffects>0&&((aDefending.statusEffects&aMove.powerOnlyIfTheseStatusEffects)==EStatusEffects.None)) {
				return;
			}
			
			float attackStatPower = aAttacker.rangeAttack;
			float defenseStat = aDefending.rangeDefense;
			if(aMove.rangeStatus == ERangedStatus.Melee) {
				attackStatPower = aAttacker.meleeAttack;
				defenseStat = aDefending.meleeDefense;
			}
			
			bool criticalHitRandom = BattleRandomizer.random < (aMove.criticalHitChance*aAttacker.criticalHitChanceMultiplier);
			
			float dmg = 0;
			float selfHitPercent = aMove.selfInflictPercent;
			bool criticalApplied = false;
			if(criticalHitRandom) {
				if(aDefending.criticalHitImmune) {
					BattleBase.DebugText("Critical hit immune");
				} else {
					attackStatPower *= 2;
					criticalApplied = true;
					BattleBase.DebugText("Critical hit being applied");
				}
				
			} else {
				
				BattleBase.DebugText("No critical hit");
			}
			
			
			switch(aMove.powerApplicationType) {
				case(EPowerApplicationTypes.Normal):
					float attackPower = aMove.getPower(aAttacker.unlockLevelForMove(aMove));;
					
					float stab = 1.0f;
					if(aMove.elementType==aAttacker.monster.elementType) {
						stab = 1.15f;
					} else if(aMove.elementType==aAttacker.monster.secondaryType) {
						stab = 1.075f;
					}
					
					int random = (int) (BattleRandomizer.random*15)+85;
					if(attackStatPower == 0) {
						
					}
					if(attackersEffect!=null) {
						if(!attackersEffect.applyToSelf) {
							// My attackers effect does something to the opponent.
							attackStatPower = attackStatPower * attackersEffect.getEffectOnAttackPower(aMove.rangeStatus,aMove.elementType);
							selfHitPercent += attackersEffect.moveRef.selfInflictPercent;
						}
						
					}
					BattleBase.DebugText("Defending Monster is: "+aDefending.name+" - Level: "+aDefending.monster.level);
					
					float weaknessStrength = aDefending.getWeaknessStrengthToElement(aMove.elementType);
					if(weaknessStrength>1f)
						this.onMonsterCommentary((BattleMonster) aDefending,"Effective vs. "+aDefending.monster.name,ECommentaryMessageType.DmgEffective); else 
						if(weaknessStrength<1f) {
							this.onMonsterCommentary((BattleMonster) aDefending,"Ineffective vs. "+aDefending.monster.name,ECommentaryMessageType.DmgInEffective); 	
						}
					BattleBase.DebugText("Random in use is: "+random+" - Move element is: "+aMove.elementType.Name+", Move Range: "+aMove.rangeStatus+",Range Defense: "+aDefending.meleeDefense+"  - Melee Defense: "+aDefending.rangeDefense);
					if(attackPower>0) 
						dmg = ((((2 * aAttacker.monster.level / 5 + 2) * attackStatPower * attackPower / defenseStat) / 50) + 2) * stab * aDefending.getWeaknessStrengthToElement(aMove.elementType) * random / 100;
					dmg = (float) Math.Ceiling(dmg*2);
					BattleBase.DebugText("((((2 * "+aAttacker.monster.level+" / 5 + 2) * "+attackStatPower+" * "+attackPower+" / "+defenseStat+") / 50) + 2) * "+stab+" * "+aDefending.getWeaknessStrengthToElement(aMove.elementType)+" * "+random+" / 100");
					
					BattleBase.DebugText("Dmg to apply is: "+dmg);
				break;
				case(EPowerApplicationTypes.PowerIsPercentOfHP):
					dmg = (aMove.power/100)*aDefending.monster.MaxHP;
				break;
						
			}

			if(defendersEffect!=null) {
				if(defendersEffect.applyToSelf) {
					
				} else {
					this.applyStatusEffectToMonster(aDefending,defendersEffect.moveRef,1.0f,aAttacker);
				}
			}
			
			if(aDefending.oneHitKOImmune&&aDefending.hp==aDefending.monster.MaxHP&&dmg>=aDefending.monster.MaxHP) {
				dmg = aDefending.monster.MaxHP-1f;
			}

			EMonsterPos defendingPosition = monsterPositionByMonster(aDefending as BattleMonster);
			if(dmg>0) {
				dmg = dmg*aSplashPercent;
				if(dmg>aDefending.hp) {
					dmg = aDefending.hp;
				}
				
				BattleBase.DebugText("HP before is: "+aDefending.hp);
				aDefending.takeHP(dmg,this._position,defendingPosition,criticalApplied);
				
				BattleBase.DebugText("HP after is: "+aDefending.hp);
				
			}
			if(selfHitPercent>0f&&aSplashPercent==1f) {
				float selfDamage = dmg * selfHitPercent;
				
				BattleBase.DebugText("Self hit damage is "+selfDamage);
				aAttacker.takeHP((int) selfDamage,otherPosition(),aAttackersPosition);	
			} else {
				float selfHeal = dmg * selfHitPercent*-1;;
				if(selfHeal>0f)
					aAttacker.addHP(selfHeal,otherPosition(),aAttackersPosition);
			}
			
			
		}
Ejemplo n.º 4
0
		private void applyHPBoostEffectToMonster(BattleMonsterWithMoves aBooster,MoveLibItem aMove,BattleMonsterWithMoves aBoosted,CommentaryManager aCommentaryManagern) {
			
			
			float attackStatPower = aBooster.rangeAttack;
			float defenseStat = aBoosted.rangeDefense;
			if(aMove.rangeStatus == ERangedStatus.Melee) {
				attackStatPower = aBooster.meleeAttack;
				defenseStat = aBoosted.meleeDefense;
			}
			
			
			float dmg = 0;
			float selfHitPercent = aMove.selfInflictPercent;
			bool criticalApplied = false;
			
			
			
			switch(aMove.powerApplicationType) {
			case(EPowerApplicationTypes.Normal):
				float attackPower = aMove.getPower(aBooster.unlockLevelForMove(aMove));;
				
				float stab = 1.0f;
				if(aMove.elementType==aBooster.monster.elementType) {
					stab = 1.5f;
				} else if(aMove.elementType==aBooster.monster.secondaryType) {
					stab = 1.25f;
				}
				
				int random = (int) (BattleRandomizer.random*15)+85;
				if(attackStatPower == 0) {
					
				}

							
				float weaknessStrength = aBoosted.getWeaknessStrengthToElement(aMove.elementType);
				if(attackPower>0) 
					dmg = ((((2 * aBooster.monster.level / 5 + 2) * attackStatPower * attackPower / defenseStat) / 50) + 2) * stab * aBoosted.getWeaknessStrengthToElement(aMove.elementType) * random / 100;
				dmg = (float) Math.Ceiling(dmg*2);
				BattleBase.DebugText("((((2 * "+aBooster.monster.level+" / 5 + 2) * "+attackStatPower+" * "+attackPower+" / "+defenseStat+") / 50) + 2) * "+stab+" * "+aBoosted.getWeaknessStrengthToElement(aMove.elementType)+" * "+random+" / 100");
				
				BattleBase.DebugText("Dmg to apply is: "+dmg);
				break;
			case(EPowerApplicationTypes.PowerIsPercentOfHP):
					dmg = (aMove.power/100)*aBooster.monster.MaxHP;
				break;
				
			}
			
			if(selfHitPercent>0f) {
				float selfDamage = dmg * selfHitPercent;
				aBooster.takeHP((int) selfDamage,otherPosition(),aBooster.myPosition);	
			} else {
				float selfHeal = dmg * selfHitPercent*-1;;
				if(selfHeal>0f)
					aBooster.addHP(selfHeal,otherPosition(),aBooster.myPosition);
			}
			
			EMonsterPos defendingPosition = monsterPositionByMonster(aBoosted as BattleMonster);
			if(dmg>0)
				aBoosted.addHP(dmg,this._position,defendingPosition);
			
			
			this.applyStatusEffectToMonster(aBooster,aMove,1f,aBoosted);
		}
Ejemplo n.º 5
0
		private float applyStatusEffectToMonster(BattleMonsterWithMoves aAttacker,MoveLibItem aMove,float aSplashPercent,BattleMonsterWithMoves aDefending) {
			if(aDefending==null) {
				Debug.Log ("Trying to apply status effect to null");
				return 0f;
			}
			return aDefending.applyStatusEffectsForMove(aMove,aSplashPercent);
			
		}
Ejemplo n.º 6
0
		protected bool containsMonster(BattleMonsterWithMoves aMonster) {
			BetterList<BattleMonster> ms = this.monstersAsBattleMonster;
			for(byte c = 0;c<ms.size;c++) {
					if(ms[c]==aMonster) {
						return true;
					}
				}
				return false;
		}
Ejemplo n.º 7
0
		private IEnumerator delayedToStartRunAnim(BattleMonsterWithMoves aActionMonster,float aDelay,float aSecondDelay) {
			yield return new WaitForSeconds (aDelay);
			aActionMonster.setAnimation(EMonsterAnimations.Run);
			yield return new WaitForSeconds (aSecondDelay);
			BattleTeam targetTeam = teamFromPosition(_currentItem.targetTeam);			
			EMonsterPos pos = targetTeam.updatedTargetPosition(_currentItem.targetMonster);

			Vector3 targetMonsterPosition = BattleConstants.getFaceOffPosition(this._currentItem.targetTeam,pos,this.transform.parent.gameObject.transform.position);
			BattleMonster b = targetTeam.getClosestMonsterTo (targetMonsterPosition);

			//TODO ANIM set camera mounts for running here...
			this.setCamera (b.gameObject, EMonsterCamPosition.FrontSide,false, true, false, b.transform);
			// Get targets
			 
		}
Ejemplo n.º 8
0
		private IEnumerator delayedToStartTackleRunAnim(BattleMonsterWithMoves aActionMonster,float aDelay) {
			
			aActionMonster.onSpawnAttack += onDoSpawnAttack;
			yield return new WaitForSeconds(aDelay);
			
			aActionMonster.doAttackAnimation(this._currentItem);
		}