예제 #1
0
		protected IEnumerator doAttackAnimation(MoveLibItem aMoveItem) {
			
			BetterList<BattleMonster> allTargets = new BetterList<BattleMonster>();
			allTargets.Add(this.monster);
			yield return new WaitForSeconds(0.45f);
			for(int i = 0;i<allTargets.size;i++) {
				
				GameObject animPrefab = aMoveItem.attackAnimationPrefab;
				if(animPrefab!=null)
					animPrefab.tag = "ParticleSystems";
				MoveAnimationLibItem anim = aMoveItem.attackAnimation;
				if(anim.movementType=="Normal") {
					if(animPrefab!=null)
						animPrefab.transform.position = allTargets[i].SpawnPosition;
				} else {
					if(animPrefab!=null) {
						animPrefab.transform.position = monster.SpawnPosition;
						Hashtable h = new Hashtable();
						h.Add("position",new Vector3(10,0,0));
						h.Add ("time",aMoveItem.attackAnimation.seconds);
						h.Add ("oncompletetarget",this.gameObject);
						h.Add ("oncomplete","AttackAnimationFinish");
						h.Add ("oncompleteparams",animPrefab);
					//	h.Add("easetype",iTween.EaseType.easeInQuad);
					//	iTween.MoveTo(animPrefab,h);
					}
				}
			}
			putParticlesInfront();
			//		StartCoroutine(pauseForDefenseAnim(targetMonster,0.01f/*aMoveQueue.moveData.attackAnimation.seconds*0.5f*/));
			//StartCoroutine(pauseForAttack(aMoveQueue,aMoveQueue.moveData.attackAnimation.seconds));
		}
예제 #2
0
		public MoveQueueItem(float aSpeed,MoveLibItem aMoveData,ETeamPosition aTargetTeam,EMonsterPos aTargetMonster,EMonsterPos aActionMonsterPosition) {
			_forcedSpeed = aSpeed;
			_useThisMove = aMoveData;
			targetTeam = aTargetTeam;
			targetMonster = aTargetMonster;
			actionPosition = aActionMonsterPosition;
			firstHit = true;
		}
예제 #3
0
	public MoveTreeCompletionDataRow contains(MoveLibItem aItem) {
		for(int i = 0;i<_items.size;i++) {
			if(_items[i].moveData==aItem) {
				return _items[i];
			}
		}
		return null;
	}
예제 #4
0
		public MoveQueueItem(ItemBait aBait,EMonsterCatchResult aResult) {
			_forcedSpeed = float.MaxValue;
			_useThisMove = null;
			targetTeam = ETeamPosition.RightTeam;
			targetMonster = EMonsterPos.Unset;
			actionPosition = EMonsterPos.Unset;
			baitItem = aBait;
			baitResult = aResult;
			firstHit = true;
		}
예제 #5
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;
		}
예제 #6
0
	public MoveTreeItem(MoveTreeDataRow aInitData) {
		_id = aInitData._ID;
		_preceedingMoveID = aInitData._PreceedingMoveOnTree;
		_levelToUnlock = (byte) aInitData._LevelToUnlock;
		_move = MovesLib.REF.getMove (aInitData._Move);
		_requiresEvolutionLevel = (byte) aInitData._RequiresEvolutionLevel;
		switch(aInitData._Branch) {
		case("Attacking Branch 1"):_moveBranch = EMoveBranch.AttackingBranch1;break;
		case("Attacking Branch 2"):_moveBranch = EMoveBranch.AttackingBranch2;break;
		case("Status Effect Branch"):_moveBranch = EMoveBranch.StatusEffectBranch;break;
		case("Supporting Branch"):_moveBranch = EMoveBranch.StatusEffectBranch;break;
		}

	}
예제 #7
0
		public byte unlockLevelForMove(MoveLibItem aMove) {
			for(int i = 0;i<monster.selectedMoves.size;i++) {
				if(monster.selectedMoves[i].forcedMove==aMove) {
					return (byte) monster.selectedMoves[i].forcedMoveUnlockLevel;
				}
			}
			BetterList<MoveTreeCompletionDataRow> row = this._monsterRef.unlockedMoves;
			for(int i = 0;i<row.size;i++) {
				if(row[i].moveData==aMove) {
					return row[i].currentUnlockLevel;
				}
			}
			return 0;
		}
예제 #8
0
		public void applyHPBoostForMove(MoveLibItem aItem,float aSplashPercent,ETeamPosition aTeamPosition,EMonsterPos aPosition) {
			float boostHP = 0f;
			switch(aItem.powerApplicationType) {
				case(EPowerApplicationTypes.Normal):
					//TODO Do normal power formula for boosting this monsters health
				break;
				
				case(EPowerApplicationTypes.PowerIsPercentOfHP):
					boostHP = (aItem.power/100)*this.monster.MaxHP;
				break;
			}
			if(boostHP>0f) {
				this.addHP(boostHP,aTeamPosition,aPosition);
				doCommentaryMessage(this.name+" healed by "+aItem.Name,ECommentaryMessageType.HealMessage);
			}
		}
예제 #9
0
	public PassiveEffect (PassiveEffectsRow aRow) {
		id = aRow._ID;
		name = aRow._EffectName;
		elementType = ElementalLibrary.REF.getElement(aRow._EffectType);
		description = aRow._Description;
		moveRef = MovesLib.REF.getMove(aRow._TakeEffectsFromMove);
		switch(aRow._EffectClass) {
			case("Class 1"):effectClass = 1;break;
			case("Class 2"):effectClass = 2;break;
			case("Class 3"):effectClass = 4;break;
			case("Class 4"):effectClass = 8;break;
		}
		weighting = aRow._Weighting;
		switch(aRow._ApplyWhen) {
			case("At battle start"):applyAt = EWhenToApply.BattleStart;break;
			case("When hit by %FIELDMOVETYPE%"):applyAt = EWhenToApply.WhenHitByMoveType;break;
			case("When using move of type %FIELDMOVETYPE%"):applyAt = EWhenToApply.WhenAttackingWithMoveType;break;
			case("When %STATUSEFFECTSUFFERED%"):applyAt = EWhenToApply.WhenStatusEffectsSuffered;break;
			case("When defendant is same type"):applyAt = EWhenToApply.WhenDefendentIsType;break;
			case("When allies are of type %FIELDMOVETYPE%"):applyAt = EWhenToApply.WhenAlliesAreType;break;
			case("When hit"):applyAt = EWhenToApply.WhenHit;break;
			case("When HP Higher than %HPPERCENTAGE%"):applyAt = EWhenToApply.WhenMyHPHigherThan;break;
			case("When HP Lower than %HPPERCENTAGE%"):applyAt = EWhenToApply.WhenMyHPLowerThan;break;
			case("When defendant HP Lower than %HPPERCENTAGE%"):applyAt = EWhenToApply.WhenTheirHPLowerThan;break;
			case("When defendant HP Higher than %HPPERCENTAGE%"):applyAt = EWhenToApply.WhenTheirHPHigherThan;break;
			case("When hit by %MOVERANGETYPE%"):applyAt = EWhenToApply.WhenHitByRangeType;break;
			case("At end of move queue"):applyAt = EWhenToApply.AtEndOfMoveQueue;break;
			case("When hit by %FIELDMOVETYPE% at end of move queue"):applyAt = EWhenToApply.WhenHitByMoveTypeAtEndOfMoveQueue;break;
			case("When one opponent is %FIELDMOVETYPE%"):applyAt = EWhenToApply.WhenOneOpponentisType;break;
			case("When one opponent is same as effect owner"):applyAt = EWhenToApply.WhenOneOpponentisSameAsEffectOwner;break;
			
		}
		whenMoveElementType = ElementalLibrary.REF.getElement(aRow._MoveElementType);
		switch(aRow._MoveRangeType) {
			default: this.whenRangeType = ERangedStatus.MeleeAndRanged;break;
			case("Melee"):this.whenRangeType = ERangedStatus.Melee;break;
			case("Ranged"):this.whenRangeType = ERangedStatus.Ranged;break;
		}
		
		whenStatusEffects = (EStatusEffects) aRow._StatusEffectSuffered;
		HPPercentage = aRow._HPPercentage;
	}
예제 #10
0
		public BetterList<BattleMonster> getTargetsForMove(EMonsterPos aPrimaryTarget,MoveLibItem aMove) {
		
	
			if(((aMove.splashRange&ESplashRange.AllHits)==0)&&(aMove.splashRange!=0)) {
				return new BetterList<BattleMonster>();
			}
			BetterList<BattleMonster> ms = this.monstersAsBattleMonster;
			if(ms.size==0) {
				return new BetterList<BattleMonster>();
			}
			int splashRange = (int) aMove.splashRange;
			BetterList<BattleMonster> r = new BetterList<BattleMonster>();
			if(aMove.splashRange==ESplashRange.RandomOpponent) {
				int randomItem = (int) (BattleRandomizer.random*ms.size);
				
				r.Add(ms[randomItem]); 
				return r;
			}
			int primTarget = (int) aPrimaryTarget;
			
			
			switch(aPrimaryTarget) {
				case(EMonsterPos.Front):case(EMonsterPos.Unset): {
					r.Add(ms[BattleConstants.FRONT_INDEX]);
					if(aMove.splashRange==ESplashRange.HitAll||aMove.splashRange==ESplashRange.SplashRange1) {
						// Middle monster has no splash range 1, only lessened damage to splashers
						r.Add(ms[BattleConstants.TOP_INDEX]);
						r.Add(ms[BattleConstants.BOTTOM_INDEX]);
					}
				}
				break;
			case(EMonsterPos.Top): {
				r.Add(ms[BattleConstants.TOP_INDEX]);
				if(aMove.splashRange==ESplashRange.HitAll||aMove.splashRange==ESplashRange.SplashRange1) {
					r.Add(ms[BattleConstants.FRONT_INDEX]);
					if(aMove.splashRange==ESplashRange.HitAll)
						r.Add (ms[BattleConstants.BOTTOM_INDEX]);
				}
			}
			break;
			case(EMonsterPos.Bottom): {
				r.Add(ms[BattleConstants.BOTTOM_INDEX]);
				if(aMove.splashRange==ESplashRange.HitAll||aMove.splashRange==ESplashRange.SplashRange1) {
					// Middle monster has no splash range 1, only lessened damage to splashers
					r.Add(ms[BattleConstants.FRONT_INDEX]);
					if(aMove.splashRange==ESplashRange.HitAll)
						r.Add (ms[BattleConstants.TOP_INDEX]);
				}
			}
			break;
			}
			
			// Remove those with no HP left
			r = cleanReturnTargets(r);
			
			if(r.size==0&&!this.teamIsDead) {
				// Aim downwards if we can
				switch(aPrimaryTarget) {
					case(EMonsterPos.Top): return getTargetsForMove(EMonsterPos.Bottom,aMove);
					case(EMonsterPos.Front): return getTargetsForMove(EMonsterPos.Top,aMove);
					case(EMonsterPos.Bottom): return getTargetsForMove(EMonsterPos.Front,aMove);
				}
				
			}
			
			return r;
		}
예제 #11
0
		public BetterList<BattleMonster> getBoostTargetsForMove(EMonsterPos aPrimaryTarget,MoveLibItem aMove,BattleMonster aActioningMonster) {
			BetterList<BattleMonster> ms = this.monstersAsBattleMonster;
			BetterList<BattleMonster> r = new BetterList<BattleMonster>();
			if(aMove==null) {
				Debug.LogError ("Move for "+aActioningMonster.name+" was "+aMove+". Monsters passive effect was: "+aActioningMonster.monster.passiveEffect.name);
				return r;
			}
			ESplashRange splashRange = aMove.splashRange;
			int boostInfo = (int) aMove.splashRange;
			if((splashRange&ESplashRange.AllBoosts)==0) {
				return new BetterList<BattleMonster>();
			}
			if(aMove.splashRange==ESplashRange.Boost2) {
				for(int i = 0;i<ms.size;i++) {
					if(ms[i]!=aActioningMonster) {
						r.Add(ms[i]);
					}
				}
				r = cleanReturnTargets(r);
				return r;
			}
			switch(aPrimaryTarget) {
			case(EMonsterPos.Front): {
				r.Add(ms[BattleConstants.FRONT_INDEX]);
				if(aMove.splashRange==ESplashRange.BoostAll/*||aMove.splashRange==ESplashRange.Boost1*/) {
					// Middle monster has no splash range 1, only lessened damage to splashers
					r.Add(ms[BattleConstants.TOP_INDEX]);
					r.Add(ms[BattleConstants.BOTTOM_INDEX]);
				}
			}
				break;
			case(EMonsterPos.Top): {
				r.Add(ms[BattleConstants.TOP_INDEX]);
				if(aMove.splashRange==ESplashRange.BoostAll/*||aMove.splashRange==ESplashRange.Boost1*/) {
					r.Add(ms[BattleConstants.FRONT_INDEX]);
					if(aMove.splashRange==ESplashRange.BoostAll)
						r.Add (ms[BattleConstants.BOTTOM_INDEX]);
				}
			}
				break;
			case(EMonsterPos.Bottom): {
				r.Add(ms[BattleConstants.BOTTOM_INDEX]);
				if(aMove.splashRange==ESplashRange.BoostAll/*||aMove.splashRange==ESplashRange.Boost1*/) {
					// Middle monster has no splash range 1, only lessened damage to splashers
					r.Add(ms[BattleConstants.FRONT_INDEX]);
					if(aMove.splashRange==ESplashRange.BoostAll)
						r.Add (ms[BattleConstants.TOP_INDEX]);
				}
			}
				break;
			}

			
			r = cleanReturnTargets(r);
			
			if(r.size==0&&!this.teamIsDead) {
				// Aim downwards if we can
				switch(aPrimaryTarget) {
					case(EMonsterPos.Top): return getBoostTargetsForMove(EMonsterPos.Front,aMove,aActioningMonster);
					case(EMonsterPos.Front): return getBoostTargetsForMove(EMonsterPos.Bottom,aMove,aActioningMonster);
					case(EMonsterPos.Bottom): return getBoostTargetsForMove(EMonsterPos.Top,aMove,aActioningMonster);
				}
				
			}
			return r;
		}
예제 #12
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);
			}
			
			
		}
예제 #13
0
	private void removeResponsibleMove(EStatusEffects aEffects) {
		if((aEffects&EStatusEffects.Burn)==EStatusEffects.Burn) {
			_reasonForBurn = null;
		}
		if((aEffects&EStatusEffects.Confusion)==EStatusEffects.Confusion) {
			_reasonForConfusion = null;
		}
		if((aEffects&EStatusEffects.Flinch)==EStatusEffects.Flinch) {
			_reasonForFlinch = null;
		}
		if((aEffects&EStatusEffects.Freeze)==EStatusEffects.Freeze) {
			_reasonForFreeze = null;
		}
		if((aEffects&EStatusEffects.Paralyze)==EStatusEffects.Paralyze) {
			_reasonForParalyze = null;
		}
		if((aEffects&EStatusEffects.Poison)==EStatusEffects.Poison) {
			_reasonForPoison = null;
		}
		if((aEffects&EStatusEffects.Sleep)==EStatusEffects.Sleep) {
			_reasonForSleep = null;
		}
	}
예제 #14
0
	private void setResponsibleMove(EStatusEffects aEffects,MoveLibItem aMove) {
		if((aEffects&EStatusEffects.Burn)==EStatusEffects.Burn) {
			_reasonForBurn = aMove;
		}
		if((aEffects&EStatusEffects.Confusion)==EStatusEffects.Confusion) {
			_reasonForConfusion = aMove;
		}
		if((aEffects&EStatusEffects.Flinch)==EStatusEffects.Flinch) {
			_reasonForFlinch = aMove;
		}
		if((aEffects&EStatusEffects.Freeze)==EStatusEffects.Freeze) {
			_reasonForFreeze = aMove;
		}
		if((aEffects&EStatusEffects.Paralyze)==EStatusEffects.Paralyze) {
			_reasonForParalyze = aMove;
		}
		if((aEffects&EStatusEffects.Poison)==EStatusEffects.Poison) {
			_reasonForPoison = aMove;
		}
		if((aEffects&EStatusEffects.Sleep)==EStatusEffects.Sleep) {
			_reasonForSleep = aMove;
		}
	}
예제 #15
0
		public void addMissedMessage(MoveLibItem aItem) {
			
			this.doCommentaryMessage(aItem.Name+" Missed!",ECommentaryMessageType.DamageMessage);
		}
예제 #16
0
	public void addLingeringEffect(EStatusEffects aEffect,MoveLibItem aCause) {
		lingeringEffects.addEffect(aEffect,aCause);
	}
예제 #17
0
		protected void doSleep(MoveLibItem aCause) {
			
			this._monsterRef.addLingeringEffect(EStatusEffects.Sleep,aCause);
			
		}
예제 #18
0
		protected void doPoison(MoveLibItem aCause) {
			
			this._monsterRef.addLingeringEffect(EStatusEffects.Poison,aCause);
			
		}
예제 #19
0
		protected void doParalyze(MoveLibItem aCause) {
			
			this._monsterRef.addLingeringEffect(EStatusEffects.Paralyze,aCause);
			
		}
예제 #20
0
		protected void doFlinch(MoveLibItem aCause) {
			this._monsterRef.addLingeringEffect(EStatusEffects.Flinch,aCause);
		}
예제 #21
0
		public float applyStatusEffectsForMove(MoveLibItem aMove,float aSplashPercent) {
			EStatusEffects effectsApplied = EStatusEffects.None;
			float delayToAdd = 0.0f;
			const float delayPerEffect = 1.5f;
			int invulnerableInt = (int) aMove.addsInvulnerabilityToStatus;
			int currentImmunity = (int) aMove.addsInvulnerabilityToStatus;
	//		int leftSide = (int) aMove.addsInvulnerabilityToStatus&this.immuneToStatuses;
			if((aMove.addsInvulnerabilityToStatus|this.immuneToStatuses)!=this.immuneToStatuses) {
				if(((aMove.addsInvulnerabilityToStatus&EStatusEffects.Burn)==EStatusEffects.Burn)&&(!this.invulnerableToBurn)) {
					this.immuneToStatuses = this.immuneToStatuses | EStatusEffects.Burn;
					base.doCommentaryMessage(this.name+ " became invulnerable to Burns!",ECommentaryMessageType.StandardMessage);
				}
				if(((aMove.addsInvulnerabilityToStatus&EStatusEffects.Confusion)==EStatusEffects.Confusion)&&(!this.invulnerableToConfusion)) {
					this.immuneToStatuses = this.immuneToStatuses | EStatusEffects.Confusion;
					base.doCommentaryMessage(this.name+ " became invulnerable to Confusion!",ECommentaryMessageType.StandardMessage);
				}
				if(((aMove.addsInvulnerabilityToStatus&EStatusEffects.Freeze)==EStatusEffects.Freeze)&&(!this.invulnerableToFreeze)) {
					this.immuneToStatuses = this.immuneToStatuses | EStatusEffects.Freeze;
					base.doCommentaryMessage(this.name+ " became invulnerable to being Frozen!",ECommentaryMessageType.StandardMessage);
				}
				if(((aMove.addsInvulnerabilityToStatus&EStatusEffects.Paralyze)==EStatusEffects.Paralyze)&&(!this.invulnerableToParalyzed)) {
					this.immuneToStatuses = this.immuneToStatuses | EStatusEffects.Paralyze;
					base.doCommentaryMessage(this.name+ " became invulnerable to being Paralyzed!",ECommentaryMessageType.StandardMessage);
				}
				if(((aMove.addsInvulnerabilityToStatus&EStatusEffects.Poison)==EStatusEffects.Poison)&&(!this.invulnerableToPoison)) {
					this.immuneToStatuses = this.immuneToStatuses | EStatusEffects.Poison;
					base.doCommentaryMessage(this.name+ " became invulnerable to Poison!",ECommentaryMessageType.StandardMessage);
				}
				if(((aMove.addsInvulnerabilityToStatus&EStatusEffects.Sleep)==EStatusEffects.Sleep)&&(!this.invulnerableToSleep)) {
					this.immuneToStatuses = this.immuneToStatuses | EStatusEffects.Sleep;
					base.doCommentaryMessage(this.name+ " became invulnerable to being put to Sleep!",ECommentaryMessageType.StandardMessage);
				}
			}
			PassiveEffect statusPassiveEffect = null;
			if(aMove.burnPercent<0&&(aMove.burnPercent*-1)*aSplashPercent>BattleRandomizer.random&&this._monsterRef.hasStatusEffect(EStatusEffects.Burn)) {
				delayToAdd += delayPerEffect;
				this.monster.removeLingeringEffect(EStatusEffects.Burn);
			} else
			if(aMove.burnPercent*aSplashPercent>BattleRandomizer.random&&!this._monsterRef.hasStatusEffect(EStatusEffects.Burn)) {
				if(this.invulnerableToBurn) {
					doBurn(aMove);
					effectsApplied = effectsApplied | EStatusEffects.Burn;
					delayToAdd += delayPerEffect;
					statusPassiveEffect = this.monster.hasPassiveEffectForTime(EWhenToApply.WhenStatusEffectsSuffered,0f,this.monster.HpAsPercentage,ElementalLibrary.REF.getElement("Normal"),this.monster.elementType,null,null,aMove.rangeStatus,(BattleMonster) this,aMove.elementType,EStatusEffects.Burn);
				}
			}
			if(aMove.confusionPercent<0&&(aMove.confusionPercent*-1)*aSplashPercent>BattleRandomizer.random&&this._monsterRef.hasStatusEffect(EStatusEffects.Confusion)) {
				delayToAdd += delayPerEffect;
				this.monster.removeLingeringEffect(EStatusEffects.Confusion);
			} else
			if(aMove.confusionPercent*aSplashPercent>BattleRandomizer.random&&!this._monsterRef.hasStatusEffect(EStatusEffects.Confusion)) {
				if(this.invulnerableToConfusion) {
					doConfusion(aMove);
					effectsApplied = effectsApplied | EStatusEffects.Confusion;
					delayToAdd += delayPerEffect;
					statusPassiveEffect = this.monster.hasPassiveEffectForTime(EWhenToApply.WhenStatusEffectsSuffered,0f,this.monster.HpAsPercentage,ElementalLibrary.REF.getElement("Normal"),this.monster.elementType,null,null,aMove.rangeStatus,(BattleMonster) this,aMove.elementType,EStatusEffects.Confusion);
				}
			}	
			
			if(aMove.flinchPercent*aSplashPercent>BattleRandomizer.random&&!this._monsterRef.hasStatusEffect(EStatusEffects.Flinch)) {
				doFlinch(aMove);
				effectsApplied = effectsApplied | EStatusEffects.Flinch;
				delayToAdd += delayPerEffect;
				
				statusPassiveEffect = this.monster.hasPassiveEffectForTime(EWhenToApply.WhenStatusEffectsSuffered,0f,this.monster.HpAsPercentage,ElementalLibrary.REF.getElement("Normal"),this.monster.elementType,null,null,aMove.rangeStatus,(BattleMonster) this,aMove.elementType,EStatusEffects.Flinch);
			}
			if(aMove.freezePercent<0&&(aMove.freezePercent*-1)*aSplashPercent>BattleRandomizer.random&&this._monsterRef.hasStatusEffect(EStatusEffects.Freeze)) {
				delayToAdd += delayPerEffect;
				this.monster.removeLingeringEffect(EStatusEffects.Freeze);
			} else
			if(aMove.freezePercent*aSplashPercent>BattleRandomizer.random&&!this._monsterRef.hasStatusEffect(EStatusEffects.Freeze)) {
				if(!this.invulnerableToFreeze) {
					doFreeze(aMove);
					effectsApplied = effectsApplied | EStatusEffects.Freeze;
					delayToAdd += delayPerEffect;
					
					statusPassiveEffect = this.monster.hasPassiveEffectForTime(EWhenToApply.WhenStatusEffectsSuffered,0f,this.monster.HpAsPercentage,ElementalLibrary.REF.getElement("Normal"),this.monster.elementType,null,null,aMove.rangeStatus,(BattleMonster) this,aMove.elementType,EStatusEffects.Freeze);
				}
			}
			if(aMove.paralyzePercent<0&&(aMove.paralyzePercent*-1)*aSplashPercent>BattleRandomizer.random&&this._monsterRef.hasStatusEffect(EStatusEffects.Paralyze)) {
				delayToAdd += delayPerEffect;
				this.monster.removeLingeringEffect(EStatusEffects.Paralyze);
			} else
			if(aMove.paralyzePercent*aSplashPercent>BattleRandomizer.random&&!this._monsterRef.hasStatusEffect(EStatusEffects.Paralyze)) {
				if(!this.invulnerableToParalyzed) {
					doParalyze(aMove);
					effectsApplied = effectsApplied | EStatusEffects.Paralyze;
					delayToAdd += delayPerEffect;
					
					statusPassiveEffect = this.monster.hasPassiveEffectForTime(EWhenToApply.WhenStatusEffectsSuffered,0f,this.monster.HpAsPercentage,ElementalLibrary.REF.getElement("Normal"),this.monster.elementType,null,null,aMove.rangeStatus,(BattleMonster) this,aMove.elementType,EStatusEffects.Paralyze);
				}
			}
			if(aMove.poisonPercent<0&&(aMove.poisonPercent*-1)*aSplashPercent>BattleRandomizer.random&&this._monsterRef.hasStatusEffect(EStatusEffects.Poison)) {
				delayToAdd += delayPerEffect;
				this.monster.removeLingeringEffect(EStatusEffects.Poison);
			} else
			if(aMove.poisonPercent*aSplashPercent>BattleRandomizer.random&&!this._monsterRef.hasStatusEffect(EStatusEffects.Poison)) {
				if(!this.invulnerableToPoison) {
					doPoison(aMove);
					effectsApplied = effectsApplied | EStatusEffects.Poison;
					delayToAdd += delayPerEffect;
					
					statusPassiveEffect = this.monster.hasPassiveEffectForTime(EWhenToApply.WhenStatusEffectsSuffered,0f,this.monster.HpAsPercentage,ElementalLibrary.REF.getElement("Normal"),this.monster.elementType,null,null,aMove.rangeStatus,(BattleMonster) this,aMove.elementType,EStatusEffects.Poison);
				}
			}
			if(aMove.sleepPercent<0&&(aMove.sleepPercent*-1)*aSplashPercent>BattleRandomizer.random&&this._monsterRef.hasStatusEffect(EStatusEffects.Sleep)) {
				delayToAdd += delayPerEffect;
				this.monster.removeLingeringEffect(EStatusEffects.Sleep);
			} else
			if(aMove.sleepPercent*aSplashPercent>BattleRandomizer.random&&!this._monsterRef.hasStatusEffect(EStatusEffects.Sleep)) {
				if(!this.invulnerableToSleep) {
					doSleep(aMove);
					this.doRestAnimation();
					effectsApplied = effectsApplied | EStatusEffects.Sleep;
					delayToAdd += delayPerEffect;
					
					statusPassiveEffect = this.monster.hasPassiveEffectForTime(EWhenToApply.WhenStatusEffectsSuffered,0f,this.monster.HpAsPercentage,ElementalLibrary.REF.getElement("Normal"),this.monster.elementType,null,null,aMove.rangeStatus,(BattleMonster) this,aMove.elementType,EStatusEffects.Sleep);
				}
			}
			
			if(statusPassiveEffect!=null) {
				CommentaryManager.REF.passiveEffect = statusPassiveEffect;
				CommentaryManager.REF.battleMonster = (BattleMonster) this;
				
				this.applyStatEffectsFromMove(statusPassiveEffect.moveRef,null);
				
				CommentaryManager.REF.passiveEffect = null;
				CommentaryManager.REF.battleMonster = null;
				
			}
			if(aMove.addsWeaknessTo!=null) {
				if(BattleRandomizer.random<aMove.chanceOfAddVulnerability) {
					byte duration = aMove.effectsDuration;
					if(aMove.effectsDuration==0) {
						duration = (byte) ((BattleRandomizer.random*3)+1);
					}
					this._monsterRef.addVulnerability(aMove.addsWeaknessTo,duration);
					base.doCommentaryMessage(this.name+ " became vulnerable to "+aMove.addsWeaknessTo.Name+" Moves for "+duration+" Turns!",ECommentaryMessageType.StandardMessage);
					
				}
			}
			
			return delayToAdd;
			
		}
예제 #22
0
		private float applyStatEffectsToMonster(BattleMonster aMonster,MoveLibItem aMoveData,MoveQueueItem aMoveQueueItem) {
			return aMonster.applyStatEffectsFromMove(aMoveData,aMoveQueueItem);
		}
예제 #23
0
		public void setFutureMove(MoveLibItem aMoveData,ETeamPosition aTargetTeam,EMonsterPos aTargetMonster,bool aAutomatic) {
			for(byte i = 0;i<moves.size;i++) {
				
				if(moves[i]!=null&&moves[i].moveData!=null&&moves[i].moveData.Name==aMoveData.Name) {
					setFutureMove (i,aTargetTeam,aTargetMonster,aAutomatic);
					return;
				}
			}
			
			
		}
예제 #24
0
		private bool accuracyShouldHit(MoveLibItem aMove,int aMonsterAccuracy,int aDefendingEvasion) {
			float acc = aMove.accuracy;
			acc = acc*((float) aMonsterAccuracy/(float) aDefendingEvasion);
			if(acc>1f) {
				return true;
			} else {
				float r = BattleRandomizer.random;
				BattleBase.DebugText("Random from accuracy is: "+r+" and acc is: "+acc);
				if(acc>r) {
					return true;
				} else {
					return false;
				}
			}
		}
예제 #25
0
		public float applyStatusEffectsForMove(MoveLibItem aMove,float aSplashPercent,PassiveEffect aEffect) {
			return applyStatusEffectsForMove(aMove,aSplashPercent);
		}
예제 #26
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);
			
		}
예제 #27
0
	public void addEffect(EStatusEffects aEffect,MoveLibItem aMove) {
		if(!hasEffect(aEffect)) {
			_currentStatusEffects = _currentStatusEffects | aEffect;
			setResponsibleMove(aEffect,aMove);
			if((EStatusEffects.Confusion & aEffect) == EStatusEffects.Confusion) {
				_turnsOfConfusion = 1+(int) (BattleRandomizer.random*MAX_TURNS_OF_CONFUSION);//(1,MAX_TURNS_OF_CONFUSION);
			}
			if((EStatusEffects.Sleep & aEffect) == EStatusEffects.Sleep) {
				_turnsOfSleep = 1+(int) (BattleRandomizer.random*MAX_TURNS_OF_SLEEP);;
			}
			if(onStatusEffectAdded!=null) {
				onStatusEffectAdded(aEffect);
			}
		}
	}
예제 #28
0
		private PassiveEffect getAttackHPHitPassiveEffect(BattleMonster aAttacker,BattleMonster aDefender,MoveLibItem aMove) {
			PassiveEffect p = aAttacker.monster.hasPassiveEffectForTime(EWhenToApply.WhenAttackingWithMoveType,
			aDefender.monster.HpAsPercentage,
			aAttacker.monster.HpAsPercentage,
			aAttacker.monster.elementType,
			aDefender.monster.elementType,
			this.monstersAsBattleMonster,
			null,
			aMove.rangeStatus,
			aAttacker,
			aMove.elementType);
			
			if(p!=null) {
				return p;
			}
			
			p = aAttacker.monster.hasPassiveEffectForTime(EWhenToApply.WhenMyHPHigherThan,
			                                                            aDefender.monster.HpAsPercentage,
			                                                            aAttacker.monster.HpAsPercentage,
			                                                            aAttacker.monster.elementType,
			                                                            aDefender.monster.elementType,
			                                                            this.monstersAsBattleMonster,
			                                                            null,
			                                                            aMove.rangeStatus,
			                                             				 aAttacker,
			                                             				 aMove.elementType);
			if(p!=null) {
				return p;
			}
			
			p = aAttacker.monster.hasPassiveEffectForTime(EWhenToApply.WhenMyHPLowerThan,
			                                              aDefender.monster.HpAsPercentage,
			                                              aAttacker.monster.HpAsPercentage,
			                                              aAttacker.monster.elementType,
			                                              aDefender.monster.elementType,
			                                              this.monstersAsBattleMonster,
			                                              null,
			                                              aMove.rangeStatus,
			                                              aAttacker,
			                                              aMove.elementType);
			if(p!=null) {
				return p;
			}
			
			p = aAttacker.monster.hasPassiveEffectForTime(EWhenToApply.WhenOpponentHasStatusEffect,
			                                              aDefender.monster.HpAsPercentage,
			                                              aAttacker.monster.HpAsPercentage,
			                                              aAttacker.monster.elementType,
			                                              aDefender.monster.elementType,
			                                              this.monstersAsBattleMonster,
			                                              null,
			                                              aMove.rangeStatus,
			                                              aAttacker,
			                                              aMove.elementType);
			if(p!=null) {
				return p;
			}

			p = aAttacker.monster.hasPassiveEffectForTime(EWhenToApply.WhenStatusEffectsSuffered,
			                                              aDefender.monster.HpAsPercentage,
			                                              aAttacker.monster.HpAsPercentage,
			                                              aAttacker.monster.elementType,
			                                              aDefender.monster.elementType,
			                                              this.monstersAsBattleMonster,
			                                              null,
			                                              aMove.rangeStatus,
			                                              aAttacker,
			                                              aMove.elementType);
			if(p!=null) {
				return p;
			}
			
			
			return null;
		}
예제 #29
0
	public EStatusEffects lingeringAllowsMove() {
		// Snap out of flinch if we're flinching.
		if((_currentStatusEffects&EStatusEffects.Flinch)==EStatusEffects.Flinch) {
			removeEffect (EStatusEffects.Flinch);
			return EStatusEffects.Flinch;
		}
		int r = (int) Convert.ToInt32(BattleRandomizer.random*100);
		if(hasEffect(EStatusEffects.Confusion)) {
			this._turnsOfConfusion--;
			if(_turnsOfConfusion<=0) {
				this.removeEffect(EStatusEffects.Confusion);
			} else 
			if(r<CHANCE_OF_CONFUSION_HURT) {
				if(this.onStatusEffectsHPWithMove!=null) {
					this.onStatusEffectsHPWithMove(POWER_OF_CONFUSION_MOVE);
				}
				lastReasonForNoMove = this._reasonForConfusion;
				return EStatusEffects.Confusion;
			}
		}
		if(hasEffect(EStatusEffects.Freeze)) {
			if(r<CHANCE_TO_LOSE_FREEZE) {
				this.removeEffect(EStatusEffects.Freeze);
			} else {
				lastReasonForNoMove = this._reasonForFreeze;
				return EStatusEffects.Freeze;
			}
		}
		r = (int) BattleRandomizer.random*100;
		if(hasEffect(EStatusEffects.Paralyze)) {
			if(r<PARALYSIS_MOVE_CHANCE) {
				
			} else {
				lastReasonForNoMove = this._reasonForParalyze;
				return EStatusEffects.Paralyze;
			}
		}
		r = (int) BattleRandomizer.random*100;
		if(hasEffect(EStatusEffects.Sleep)) {
			this._turnsOfSleep--;
			if(this._turnsOfSleep<=0) {
				this.removeEffect(EStatusEffects.Sleep);
			} else {
				lastReasonForNoMove = _reasonForSleep;
				return EStatusEffects.Sleep;
			}
		}
		return EStatusEffects.None;
		
	}
예제 #30
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);
		}