Beispiel #1
0
		private IEnumerator postMoveStatusEffectsDelayed(MoveQueueItem aMoveQueue) {
			float dmg = 0;
			float totalWaitRequired = 0.0f;

			if (!aMoveQueue.followOnMove) {
				moveFlags = moveFlags | EMoveFlag.AnyStatusEffecting;
				if (this._monsterRef.lingeringEffects.hasEffect (EStatusEffects.Burn)) {
					// Do Burn Effects
				
					moveFlags = moveFlags | EMoveFlag.HealthChanging;
					dmg = (int)(_monsterRef.MaxHP * BURN_PERCENT);
					if (dmg > this._monsterRef.hp) {
						dmg = this._monsterRef.hp;
					}
					this.doDefenseAnimation (null);
					this.hp -= dmg;
				
					StartCoroutine (doneHPChange ());
					this.doCommentaryMessage (this.name + " is hurt by it's Burn", ECommentaryMessageType.StandardMessage);
					this.doCommentaryMessage (dmg + "", ECommentaryMessageType.DamageMessage);
					this.showStatusEffect (EStatusEffects.Burn);
					totalWaitRequired += 0.1f;
					yield return new WaitForSeconds (1.5f);
				
				}
				if (this._monsterRef.lingeringEffects.hasEffect (EStatusEffects.Poison)) {
					moveFlags |= EMoveFlag.HealthChanging;
					dmg = (int)(_monsterRef.MaxHP * POISON_PERCENT);
					if (dmg > this._monsterRef.hp) {
						dmg = this._monsterRef.hp;
					}
					this.doDefenseAnimation (null);
					this.hp -= dmg;
				
					StartCoroutine (doneHPChange ());
					MoveLibItem responsibleForPoison = this._monsterRef.lingeringEffects.responsibleForPoison;
					if (responsibleForPoison != null)
						this.doCommentaryMessage (this.name + " is Poisoned. " + this.name + " was poisoned due to " + responsibleForPoison.moveOrPassiveEffectString + " " + responsibleForPoison.Name, ECommentaryMessageType.StandardMessage);
					else {
						this.doCommentaryMessage (this.name + " is Poisoned.", ECommentaryMessageType.StandardMessage);
						
					}
					this.doCommentaryMessage (dmg + "", ECommentaryMessageType.DamageMessage);
					totalWaitRequired += 0.1f;
				
					this.showStatusEffect (EStatusEffects.Poison);
					yield return new WaitForSeconds (1.5f);
				
				
				
				}
			
				yield return new WaitForSeconds (totalWaitRequired + 0.1f);
			
			
				moveFlags = moveFlags & ~EMoveFlag.AnyStatusEffecting;
			}
			aMoveQueue.advanceMoveQueueFromState(EMoveQueueItemStatus.InflictMyEffects);
			aMoveQueue = null;
		}
Beispiel #2
0
		protected IEnumerator pauseForAttack(MoveQueueItem aMoveQueueItem,float aSeconds) {
			BetterList<BattleMonster> allTargets = aMoveQueueItem.targettedMonster;
			
			for(int i = 0;i<allTargets.size;i++) {
				
				if(aMoveQueueItem.moveData!=null) {
					if(!aMoveQueueItem.moveData.isBoost) {
						
						allTargets[i].doDefenseAnimation(this._currentItem);
					} else {
						 
						allTargets[i].doDefenseAnimation(this._currentItem);
					}
				}
			}
			
			yield return new WaitForSeconds(aSeconds);

			aMoveQueueItem.advanceMoveQueueFromState(EMoveQueueItemStatus.AttackAnimation);
		}
Beispiel #3
0
		public IEnumerator consumeItem(ITMItem aItem,MoveQueueItem aMoveQueue) {
			yield return new WaitForSeconds(0.5f);
			float hpBefore = this._monsterRef.hp;
			float energyBefore = this._monsterRef.energy;
			this._monsterRef.consumeItem(aItem,true);
			if(aItem.Type()==EItemType.BattleBoost) {
				this.applyStatEffectsFromMove((BattleBoostItem) aItem,aMoveQueue);
			}
			float hpNow = this._monsterRef.hp;
			float hpDiff = hpNow - hpBefore;
			this._monsterRef.hp -= hpDiff;
			if(hpDiff>0) {
					this.addHP(hpDiff,aMoveQueue.actioningTeam.teamPosition,aMoveQueue.actionPosition);
					
				}
			float energyNow = this._monsterRef.energy;
			float energyDiff = energyNow-energyBefore;
			if(energyDiff>0) {
				this.addEnergy(energyDiff,aMoveQueue.actioningTeam.teamPosition,aMoveQueue.actionPosition);
			}
			yield return new WaitForSeconds(0.5f);
			aMoveQueue.skipToFinish();
		}
Beispiel #4
0
		public BetterList<MoveQueueItem> reviveMoveQueue() {
			BetterList<MoveQueueItem> returnList = new BetterList<MoveQueueItem>();
			BetterList<BattleMonster> monsters = this.monstersAsBattleMonster;
			Debug.Log ("Monsters as battle monster was: "+this.monstersAsBattleMonster.size);
			
			for(int i = 0;i<monsters.size;i++) {
				if(monsters[i]!=null) {
					Debug.Log("Monster: "+i+" was "+monsters[i].name);
					monsters[i].monster.restingStatus = ERestingStatus.Awake;
					monsters[i].monster.hp =1f;
					monsters[i].hp = 1f;
					monsters[i].removeAllLingeringEffects();
					///iTween.FadeTo(monsters[i].gameObject,1f,0.5f);
					
					MoveQueueItem mq = new MoveQueueItem(float.MaxValue,MovesLib.REF.getMove("Full Revive"),this.teamPosition,this.positionForMonster(monsters[i]),this.positionForMonster(monsters[i]));
					mq.actioningMonster = (BattleMonsterWithMoves) monsters[i];
					mq.actioningTeam = (BattleTeam) this;
					mq.timesToHit = 1;
					returnList.Add(mq);
				}
			}
			Debug.Log ("Revive Move queue was: "+returnList.size);
			return returnList;
		}
Beispiel #5
0
		private float applyStatEffectsToMonster(BattleMonster aMonster,MoveLibItem aMoveData,MoveQueueItem aMoveQueueItem) {
			return aMonster.applyStatEffectsFromMove(aMoveData,aMoveQueueItem);
		}
Beispiel #6
0
		public float applyStatEffectToTeam(MoveQueueItem aItem,CommentaryManager aCommentary) {
			EStatusEffects allStatusApplied = EStatusEffects.None;
			ESplashRange splash = aItem.moveData.splashRange;
			float splashPrecent = aItem.moveData.splashPercent;
			float delayAmount = 0.0f;
			if(containsMonster(aItem.actioningMonster)) {
				if(boostsMyTeam(splash)) {
					EMonsterPos target = aItem.targetMonster;
					BetterList<BattleMonster> targets = this.getBoostTargetsForMove(target,aItem.moveData,(BattleMonster) aItem.actioningMonster);
					for(byte c = 0;c<targets.size;c++) {
						delayAmount += applyStatEffectsToMonster(targets[c],aItem.moveData,aItem);
					}
				}
			} else {
				EMonsterPos target = aItem.targetMonster;
				BetterList<BattleMonster> targets = this.getTargetsForMove(target,aItem.moveData);
				if(!boostsMyTeam(splash)) {
					targets = aItem.hitMonsters;
					for(byte c = 0;c<targets.size;c++) {
						delayAmount+= applyStatEffectsToMonster(targets[c],aItem.moveData,aItem);
					}
				}
			}
			return delayAmount;
		}
Beispiel #7
0
		private static int SortBySpeed(MoveQueueItem a1, MoveQueueItem a2) {
			if(a1.moveSpeed>a2.moveSpeed) {
				return -1;
			} else if(a1.moveSpeed==a2.moveSpeed) {
				return 0;
			}
			else
			{
				return 1;
			}
		}
Beispiel #8
0
		public void setFutureMove(ITMItem aItem) {
			
			SelectedMoveData moveData = new SelectedMoveData(aItem);
			
			if(_futureMoveInfo!=null) {
				_futureMoveInfo.cleanUp();
				_futureMoveInfo =null;
			}
			_futureMoveInfo = new MoveQueueItem(aItem,this);
			if(onMoveSet!=null) {
				Debug.Log("Setting Future Move From Item: "+aItem.Name());
				onMoveSet(this as BattleMonster,this._futureMoveInfo.moveData,false);
			}
			
		}
Beispiel #9
0
		public bool changeMoveIfNeeded(MoveQueueItem aMoveQueueItem) {
			
			MoveLibItem move = aMoveQueueItem.moveData;
			if(containsMonster(aMoveQueueItem.actioningMonster)&&move.changeIfAttackerHasStatusEffects!=0) {
				int effectsExisting = (int) ((int) (aMoveQueueItem.actioningMonster.statusEffects)&move.changeIfAttackerHasStatusEffects);
				if(effectsExisting!=0) {
					aMoveQueueItem.moveData = aMoveQueueItem.moveData.changeToThisIfAttackerHasStatusEffects;
					aMoveQueueItem.status = EMoveQueueItemStatus.Start;
					return true;
				}
			}
			else
			if(!containsMonster(aMoveQueueItem.actioningMonster)&&move.changeIfDefenderHasStatusEffects!=0) {
				
				EMonsterPos target = aMoveQueueItem.targetMonster;
				BetterList<BattleMonster> targets = this.getTargetsForMove(target,aMoveQueueItem.moveData);
				if(targets.size>0) {
					int effectsExisting = (int) (targets[0].statusEffects)&move.changeIfDefenderHasStatusEffects;
					if(effectsExisting!=0) {
						aMoveQueueItem.moveData = aMoveQueueItem.moveData.changeToThisIfDefenderHasStatusEffects;
						aMoveQueueItem.status = Battles.EMoveQueueItemStatus.Start;
						return true;
					}
				}
			}
			return false;
		}
Beispiel #10
0
		public bool applyHPBoostsToTeam(MoveQueueItem aItem,CommentaryManager aCommentary) {
			if(containsMonster(aItem.actioningMonster)) {
				ESplashRange splash = aItem.moveData.splashRange;
				float splashPrecent = aItem.moveData.splashPercent;
				
				EMonsterPos target = aItem.targetMonster;
				
				BetterList<BattleMonster> targets = getBoostTargetsForMove(target,aItem.moveData,(BattleMonster) aItem.actioningMonster);
				if(targets.size>0) {
					for(int i = 0;i<targets.size;i++) {
						applyHPBoostEffectToMonster(aItem.actioningMonster,aItem.moveData,targets[i],aCommentary);
					}
				} else {
					
				}
				return false;
			} else {

			}
			return false;
		}
Beispiel #11
0
		public bool applyHPStatusBoostsToTeam(MoveQueueItem aItem) {
			return false;
		}
Beispiel #12
0
		protected void checkIfMoveNeedsToChange(MoveQueueItem aMoveQueueItem) {
			if(!_teams[0].changeMoveIfNeeded(aMoveQueueItem))
				_teams[1].changeMoveIfNeeded(aMoveQueueItem);
			aMoveQueueItem.advanceMoveQueueFromState(EMoveQueueItemStatus.ChangeToOtherMove);
			
		}
Beispiel #13
0
		protected IEnumerator moveMonsterBackToPosition(MoveQueueItem aItem) {
			BattleTeam myTeam = aItem.actioningTeam;
			Vector3 pos = BattleConstants.getMyPosition(this.positionFromTeam(myTeam),myTeam.positionForMonster(aItem.actioningMonster.gameObject),this.transform.parent.gameObject.transform.position);
			Hashtable h = new Hashtable();
			h.Add("position",pos);
			h.Add ("time",0.5f);
		/*	h.Add ("oncompletetarget",this.gameObject);
			h.Add ("oncomplete","onDoAttackAnimation"); 
			h.Add ("oncompleteparams",actionMonster);*/
			h.Add("easetype",iTween.EaseType.easeOutCubic); 
			iTween.MoveTo(aItem.actioningMonster.gameObject,h);

			yield return new WaitForSeconds(0.5f);
			aItem.advanceMoveQueueFromState(EMoveQueueItemStatus.MoveBackToPosition);
		}
Beispiel #14
0
		protected IEnumerator applyStatusEffectsToTeams(MoveQueueItem aMoveQueueItem) {
			float delay = _teams[0].applyStatusEffectToTeam(aMoveQueueItem,this._commentaryManager);
			delay += _teams[1].applyStatusEffectToTeam(aMoveQueueItem,this._commentaryManager);
			yield return new WaitForSeconds(delay);
			aMoveQueueItem.advanceMoveQueueFromState(EMoveQueueItemStatus.StatusEffects);
		}
Beispiel #15
0
		protected void applyHPEffectsToTeams(MoveQueueItem aMoveQueueItem) {
			_teams[0].applyHPEffectToTeam(aMoveQueueItem,_commentaryManager);
			_teams[1].applyHPEffectToTeam(aMoveQueueItem,_commentaryManager);
		}
Beispiel #16
0
		protected void applyHPBoostsToTeams(MoveQueueItem aMoveQueueItem) {
			if(_teams[0].applyHPBoostsToTeam(aMoveQueueItem,_commentaryManager)||_teams[1].applyHPBoostsToTeam(aMoveQueueItem,_commentaryManager)) {
			
			} else {
				aMoveQueueItem.advanceMoveQueueFromState(EMoveQueueItemStatus.HPBoosts);
			}
		}
Beispiel #17
0
		protected void applyStatusBoostsToTeams(MoveQueueItem aMoveQueueItem) {
			if(_teams[0].applyHPStatusBoostsToTeam(aMoveQueueItem)||_teams[1].applyHPStatusBoostsToTeam(aMoveQueueItem)) {
				
			} else {
				aMoveQueueItem.advanceMoveQueueFromState(EMoveQueueItemStatus.StatusBoosts);
			}
		}
Beispiel #18
0
		public float applyStatusEffectToTeam(MoveQueueItem aItem,CommentaryManager aCommentary) {
			EStatusEffects allStatusApplied = EStatusEffects.None;
			float delay = 0.0f;
			if(containsMonster(aItem.actioningMonster)) {
				
			} else {
				ESplashRange splash = aItem.moveData.splashRange;
				float splashPercent = aItem.moveData.splashPercent;
				
				BetterList<BattleMonster> targets = aItem.hitMonsters;
				
				for(byte c = 0;c<targets.size;c++) {
						EStatusEffects effectsApplied = EStatusEffects.None;
						if(c == 0) {
							delay += applyStatusEffectToMonster(aItem.actioningMonster,aItem.moveData,1.0f,targets[c]);
							
						} else {
							delay += applyStatusEffectToMonster(aItem.actioningMonster,aItem.moveData,splashPercent,targets[c]);
						}
						allStatusApplied = allStatusApplied | effectsApplied;
					}
				}
			return delay;
			}
Beispiel #19
0
		protected void handleMoveQueueEndPassiveEffects(MoveQueueItem aMoveQueue) {
			BattleBase.DebugText("BattleControllerWithTeams->handleMoveQueueEndPassiveEffects");
			PassiveEffect effect = aMoveQueue.actioningMonster.monster.hasPassiveEffectForTime(EWhenToApply.AtEndOfMoveQueue,
			                                                                                    0f,
			                                                                                    aMoveQueue.actioningMonster.monster.HpAsPercentage,
			                                                                                    aMoveQueue.actioningMonster.monster.elementType,
			                                                                                    ElementalLibrary.REF.getElement("Normal"),
			                                                                                    aMoveQueue.actioningTeam.monstersApartFrom((BattleMonster) aMoveQueue.actioningMonster),
			                                                                                    otherTeam(aMoveQueue.actioningTeam).monstersAsBattleMonster,
			                                                                                    aMoveQueue.moveData.rangeStatus,
			                                                                                    (BattleMonster) aMoveQueue.actioningMonster,
			                                                                                    aMoveQueue.moveData.elementType);
			
			float delayAmount = 0f;
			if(effect!=null) {
				_commentaryManager.passiveEffect = effect;
				_commentaryManager.battleMonster = (BattleMonster) aMoveQueue.actioningMonster; 
				if(effect.applyToSelf) {
					delayAmount += this.teamFromMonster((BattleMonster) aMoveQueue.actioningMonster).applyPassiveEffectToMonsters(EWhenToApply.AtEndOfMoveQueue,effect,(BattleMonster) aMoveQueue.actioningMonster,aMoveQueue.actioningTeam.positionForMonster((BattleMonster) aMoveQueue.actioningMonster),aMoveQueue);
				} else {
					delayAmount += this.otherTeam(this.teamFromMonster((BattleMonster) aMoveQueue.actioningMonster)).applyPassiveEffectToMonsters(EWhenToApply.AtEndOfMoveQueue,effect,(BattleMonster) aMoveQueue.actioningMonster,aMoveQueue.actioningTeam.positionForMonster((BattleMonster) aMoveQueue.actioningMonster),aMoveQueue);
				}
				
				_commentaryManager.passiveEffect = null;
				_commentaryManager.battleMonster = null; 
			}
			
			for(int i = 0;i<aMoveQueue.hitMonsters.size;i++) {
				effect = aMoveQueue.actioningMonster.monster.hasPassiveEffectForTime(EWhenToApply.WhenHitByMoveTypeAtEndOfMoveQueue,
				                                                                     0f,
				                                                                     aMoveQueue.actioningMonster.monster.HpAsPercentage,
				                                                                     aMoveQueue.actioningMonster.monster.elementType,
				                                                                     aMoveQueue.hitMonsters[i].monster.elementType,
				                                                                     aMoveQueue.actioningTeam.monstersApartFrom((BattleMonster) aMoveQueue.actioningMonster),
				                                                                     otherTeam(aMoveQueue.actioningTeam).monstersAsBattleMonster,
				                                                                     aMoveQueue.moveData.rangeStatus,
				                                                                     (BattleMonster) aMoveQueue.actioningMonster,
				                                                                     aMoveQueue.moveData.elementType);
				if(effect!=null) {
					
					_commentaryManager.passiveEffect = effect;
					_commentaryManager.battleMonster = (BattleMonster) aMoveQueue.actioningMonster; 
					
					BattleMonster m = (BattleMonster) aMoveQueue.hitMonsters[i];
					BattleTeam myTeam = otherTeam(aMoveQueue.actioningTeam);
					if(effect.applyToSelf) {
						delayAmount += myTeam.applyPassiveEffectToMonsters(EWhenToApply.WhenHitByMoveTypeAtEndOfMoveQueue,effect,m,myTeam.positionForMonster(m),aMoveQueue);
					} else {
					
					}
					_commentaryManager.passiveEffect = null;
					_commentaryManager.battleMonster = null; 
					
					
				}
			}

			
			
			StartCoroutine(delayToAdvancedMoveQueue(EMoveQueueItemStatus.EndMoveQueuePassiveEffects,aMoveQueue,delayAmount));
			
		}
Beispiel #20
0
		private IEnumerator delayToAdvancedMoveQueue(EMoveQueueItemStatus aExpectedState,MoveQueueItem aMoveQueue,float aDelay) {
			yield return new WaitForSeconds(aDelay);
			aMoveQueue.advanceMoveQueueFromState(aExpectedState);
		}
Beispiel #21
0
		// TODO Apply HP Boosts to team?
		public bool applyHPBoostsToTeam(PassiveEffect aEffect,BattleMonster aActioningMonster,MoveQueueItem aMoveQueueItem,ETeamPosition aTeamPosition) {
			if(containsMonster(aActioningMonster)) {
				ESplashRange splash = aEffect.moveRef.splashRange;
				float splashPercent = aEffect.moveRef.splashPercent;
				if(aEffect.applyAt==EWhenToApply.WhenHitByMoveTypeAtEndOfMoveQueue&&((aMoveQueueItem.moveData.elementType==aEffect.whenMoveElementType)||(aEffect.whenMoveElementType==null))) {
				
					EMonsterPos target = positionForMonster(aActioningMonster);
					BetterList<BattleMonster> targets = getBoostTargetsForMove(target,aEffect.moveRef,aActioningMonster);
					
					if(targets.size>0) {
						for(int i =0;i<targets.size;i++) {
							if(i==0)
								targets[i].applyHPBoostForMove(aEffect.moveRef,1.0f,aTeamPosition,positionForMonster(targets[i])); else {
								targets[i].applyHPBoostForMove(aEffect.moveRef,splashPercent,aTeamPosition,positionForMonster(targets[i]));
							}
						}
					} else {
						
					}
				}
			} else {
				
			}
			return false;
		}
Beispiel #22
0
		protected void doAttackHitAnimation(MoveQueueItem aMoveQueue) {
			
			BattleTeam targetTeam = this.teamFromPosition(aMoveQueue.targetTeam);
			BattleMonster targetMonster = targetTeam.monsterFromPosition(aMoveQueue.targetMonster);
			BetterList<BattleMonster> allTargets;
			if(aMoveQueue.moveData.isBoost) {
				allTargets = targetTeam.getBoostTargetsForMove(aMoveQueue.targetMonster,aMoveQueue.moveData,(BattleMonster) aMoveQueue.actioningMonster);
			} else {
			//	allTargets = targetTeam.getTargetsForMove(aMoveQueue.targetMonster,aMoveQueue.moveData);
				allTargets = aMoveQueue.hitMonsters;

			}
			switch(aMoveQueue.moveData.cameraShake) {
				case("No Shake"):break;
				case("Tiny Shake"):this.GetComponent<CameraShake>().TinyShake();break;
				case("Small Shake"):this.GetComponent<CameraShake>().SmallShake();break;
				case("Large Shake"):this.GetComponent<CameraShake>().LargeShake();break;
				case("Massive Shake"):this.GetComponent<CameraShake>().MassiveShake();break;
			}
			bool isLeftMove = true;
			if(aMoveQueue.actioningTeam.teamPosition==ETeamPosition.RightTeam) {
				isLeftMove = false;
			}
			for(int i = 0;i<allTargets.size;i++) {
				if(i==0) {
					//this.setCamera(allTargets[0].gameObject,EMonsterCamPosition.SideCamera,false,false,false,allTargets[0].transform);
				} 
				GameObject animPrefab = aMoveQueue.moveData.attackAnimationHitPrefab;
				if(animPrefab!=null) {
					animPrefab.tag = "ParticleSystems";
					MoveAnimationLibItem anim = aMoveQueue.moveData.attackHitAnimation;
					if((anim.movementType=="Normal")||(anim.movementType=="OnTargetOnly")) {
						animPrefab.transform.position = allTargets[i].gameObject.transform.position;
						
					} else if(anim.movementType=="OriginToTarget") {
						animPrefab.transform.position = aMoveQueue.actioningMonster.SpawnPosition;
						Hashtable h = new Hashtable();
						h.Add("position",allTargets[i].SpawnPosition);
						h.Add ("time",aMoveQueue.moveData.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);
					} else if(anim.movementType=="OnOriginOnly") {
						animPrefab.transform.position = aMoveQueue.actioningMonster.SpawnPosition;
						Hashtable h = new Hashtable();
						h.Add ("time",aMoveQueue.moveData.attackAnimation.seconds);
						h.Add ("position",animPrefab.transform.position);
						h.Add ("oncompletetarget",this.gameObject);
						h.Add ("oncomplete","AttackAnimationFinish");
						h.Add ("oncompleteparams",animPrefab);
						iTween.MoveTo(animPrefab,h);
					}
					if(!isLeftMove&&aMoveQueue.moveData.attackAnimation.leftSideRotation!=0f) {
						animPrefab.transform.rotation = Quaternion.Euler(0f,anim.rightSideRotation,0f);
					} if(isLeftMove&&aMoveQueue.moveData.attackAnimation.rightSideRotation!=0f) {
						animPrefab.transform.rotation = Quaternion.Euler(0f,anim.leftSideRotation,0f);
					}
					adaptAnimPrefabPositionByOffset(animPrefab,isLeftMove,anim);
				} else {
				
				}
			}

			putParticlesInfront();
			
		}
Beispiel #23
0
		public void applyHPEffectToTeam(MoveQueueItem aItem,CommentaryManager aCommentaryManager) {
			// Does this team contain the offensive monster?
			if(containsMonster(aItem.actioningMonster)) {
				if(aItem.moveData.isBoost) {
					//this.applyStatusEffectToMonster(
				}
			} else {
				ESplashRange splash = aItem.moveData.splashRange;
				float splashPrecent = aItem.moveData.splashPercent;
				
				EMonsterPos target = aItem.targetMonster;
				BetterList<BattleMonster> targets = getTargetsForMove(target,aItem.moveData);
				
				
				for(byte c = 0;c<targets.size;c++) {
					if(c == 0) {
						if(accuracyShouldHit(aItem.moveData,aItem.actioningMonster.accuracy,targets[c].agility)) {
							aItem.addHitMonster(targets[c]);
							applyHPEffectToMonster(aItem.actioningMonster,aItem.moveData,1.0f,targets[c],aCommentaryManager,aItem.actionPosition);
						} else {
							targets[c].addMissedMessage(aItem.moveData);
						}
					} else {
						if(accuracyShouldHit(aItem.moveData,aItem.actioningMonster.accuracy,targets[c].agility)) {
							aItem.addHitMonster(targets[c]);
							applyHPEffectToMonster(aItem.actioningMonster,aItem.moveData,splashPrecent,targets[c],aCommentaryManager,aItem.actionPosition);
						} else {
							targets[c].addMissedMessage(aItem.moveData);
						}
					}
				}
			}
		} 
Beispiel #24
0
		public void setFutureMove(byte aMoveIndex,ETeamPosition aTargetTeam,EMonsterPos aTargetMonster,bool aAutomatic) {
			
			SelectedMoveData moveData = null;
			if(aMoveIndex<moves.size) 
				moveData = moves[aMoveIndex]; else {
					moveData = new SelectedMoveData();
				}
			if(_futureMoveInfo!=null) {
				_futureMoveInfo.cleanUp();
				_futureMoveInfo =null;
			}
			_futureMoveInfo = new MoveQueueItem(this.speed,moveData,aTargetTeam,aTargetMonster,this,this.myPosition);
			if(onMoveSet!=null) {
				onMoveSet(this as BattleMonster,this._futureMoveInfo.moveData,aAutomatic);
			}
			
		}
Beispiel #25
0
		public void setAIFutureMove(ETeamPosition aMyTeamPosition) {
			bool moveAllowed = false;
			int c = 10;
			while(c>=0&&!moveAllowed) {
				c--;
				byte move = (byte) (BattleRandomizer.random*this.moves.size);
				SelectedMoveData moveData = moves[move];
				while(moveData==null||moveData.moveData==null) {
					move = (byte) (BattleRandomizer.random*this.moves.size);
					moveData = moves[move];

				}
				if((moveData.move!=null&&moveData.move.itemRef!=null&&moveData.move.itemRef.moveData!=null)&&_lastMoveNameString==moveData.move.itemRef.moveData.Name) {
					moveAllowed = false;
				} else {
					moveAllowed = true;
				} 
				if(moveAllowed) {
					if(moveData.move!=null&&moveData.move.moveBranch!=null&&moveData.move.moveBranch==EMoveBranch.SupportingBranch) {
						_lastMoveNameString = moveData.move.itemRef.moveData.Name;
					} else {
						_lastMoveNameString = "";
					}
					if(_futureMoveInfo!=null) {
						_futureMoveInfo.cleanUp();
						_futureMoveInfo =null; 
					}
					
					if(moveData.moveData.isBoost) {
						_futureMoveInfo = new MoveQueueItem(this.speed,moveData,aMyTeamPosition,this._targetMonster,this,this.myPosition);
					} else 
						_futureMoveInfo = new MoveQueueItem(this.speed,moveData,this._targetTeam,this._targetMonster,this,this.myPosition);
					if(onMoveSet!=null) {
						onMoveSet(this as BattleMonster,this._futureMoveInfo.moveData,true);
					}
				}
				
			}
			

		}
Beispiel #26
0
		private void onMoveHasBeenSet(BattleTeam aTeam,BattleMonster aMonster,MoveQueueItem aMoveQueue,bool aAutomatic) {
	//		Debug.Log ("onMoveHasbeenSet");
			if(aTeam.isLocalTeam) {
				easyTarget.gameObject.SetActive(false);
				this._positionOfMoveQueueEntry++;
				BattleBase.MultiplayerDebugText("onMoveHasBeenSet (LocalTeam)!!!!!!!!!!!!!!!!!!!!!!!!");
				if(aMoveQueue.moveData!=null) {
					
					BattleBase.MultiplayerDebugText("Move was not null");
					if(aMoveQueue.moveData.isBoost) {
						
						BattleBase.MultiplayerDebugText("Is boost for team, find target in team");
						aMoveQueue.targetTeam = positionFromTeam(aTeam);
						findTargetInTeam(aTeam,aTeam,aMonster,aMoveQueue,aAutomatic);
					} else {
						
						BattleBase.MultiplayerDebugText("Is not boost for team, find target in opponent");
						findTargetInTeam(aTeam,otherTeam(aTeam),aMonster,aMoveQueue,aAutomatic);
						}
				} else {
					if(aMoveQueue.usedItem!=null) {
						aMoveQueue.targetTeam = positionFromTeam(aTeam);
						findTargetInTeam(aTeam,aTeam,aMonster,aMoveQueue,true);
					}
					
					if(aTeam.allMonstersHaveMoves) {
						
						
						aTeam.declareReadyForNextTurn();
					}
				}
			} else {
				if(aTeam.allMonstersHaveMoves) {
					aTeam.declareReadyForNextTurn();
				}
			}
		}
Beispiel #27
0
		protected IEnumerator doAttackParticlesAnimation(MoveQueueItem aMoveQueue) {

			BattleTeam targetTeam = this.teamFromPosition(aMoveQueue.targetTeam);
			BattleMonster targetMonster = targetTeam.monsterFromPosition(aMoveQueue.targetMonster);
			BetterList<BattleMonster> allTargets;
			if(aMoveQueue.moveData.isBoost) {
				allTargets = targetTeam.getBoostTargetsForMove(aMoveQueue.targetMonster,aMoveQueue.moveData,(BattleMonster) aMoveQueue.actioningMonster);
			} else {
				allTargets = targetTeam.getTargetsForMove(aMoveQueue.targetMonster,aMoveQueue.moveData);
			}
			yield return new WaitForSeconds(0.01f);
			for(int i = 0;i<allTargets.size;i++) {
				
				GameObject animPrefab = aMoveQueue.moveData.attackAnimationPrefab;
				BattleMonster thisTarget = allTargets[i];
				if(thisTarget!=null) {
					aMoveQueue.addTargettedMonster(thisTarget);
					bool isLeftMove = true;
					if(aMoveQueue.actioningTeam.teamPosition==ETeamPosition.RightTeam) {
						isLeftMove = false;
					}
					if(animPrefab!=null) {
				 		animPrefab.tag = "ParticleSystems";
						MoveAnimationLibItem anim = aMoveQueue.moveData.attackAnimation;
						if((anim.movementType=="Normal")||(anim.movementType=="OnTargetOnly")) {
							if(animPrefab==null||animPrefab.transform==null) {
								Debug.Log ("Error here");
							} else
							if(allTargets[i]==null||allTargets[i].transform==null) {
								Debug.Log("Error here1");
							} else
								animPrefab.transform.position = allTargets[i].transform.position;
						} else if(anim.movementType=="OriginToTarget") {
							animPrefab.transform.position = aMoveQueue.actioningMonster.SpawnPosition;
							Hashtable h = new Hashtable();
							h.Add("position",allTargets[i].SpawnPosition);
							h.Add ("time",aMoveQueue.moveData.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);
							this.setCamera(null,EMonsterCamPosition.TVCamera,true,true,false,animPrefab.transform);
						}
						if(!isLeftMove&&aMoveQueue.moveData.attackAnimation.leftSideRotation!=0f) {
							animPrefab.transform.rotation = Quaternion.Euler(0f,anim.rightSideRotation,0f);
							animPrefab.transform.position = aMoveQueue.actioningMonster.SpawnPosition;
						} if(isLeftMove&&aMoveQueue.moveData.attackAnimation.rightSideRotation!=0f) {
							animPrefab.transform.rotation = Quaternion.Euler(0f,anim.leftSideRotation,0f);
							animPrefab.transform.position = aMoveQueue.actioningMonster.SpawnPosition;
						}
						
						adaptAnimPrefabPositionByOffset(animPrefab,isLeftMove,anim);
						
					}

				}
				 else {
					if(aMoveQueue.moveData.isBoost) {
						allTargets = targetTeam.getBoostTargetsForMove(aMoveQueue.targetMonster,aMoveQueue.moveData,(BattleMonster) aMoveQueue.actioningMonster);
					} else {
						allTargets = targetTeam.getTargetsForMove(aMoveQueue.targetMonster,aMoveQueue.moveData);
					}
					break;
				}

			}
			putParticlesInfront();
	//		StartCoroutine(pauseForDefenseAnim(targetMonster,0.01f/*aMoveQueue.moveData.attackAnimation.seconds*0.5f*/));
			StartCoroutine(pauseForAttack(aMoveQueue,aMoveQueue.moveData.attackAnimation.seconds));
		}
Beispiel #28
0
		private void onFoundTargetForMove(MoveQueueItem aItem) {
			
			opponentTeam.onTargetFound -= onFoundTargetForMove;
			 
			playersTeam.onTargetFound -= onFoundTargetForMove;
			easyTarget.gameObject.SetActive(false);
			
			doResetMonstersDisplay();
			BattleBase.QueueText("Found Target for Move, my next unset monster is: "+playersTeam.nextUnsetMonster); 
			
			if(playersTeam.nextUnsetMonster!=null) {
				StartCoroutine(delayToShowNextMonster(this.playersTeam));
			} else {
				FadeBlackScreen(0.0f,0.1f);
				playersTeam.declareReadyForNextTurn();
			}
		}
Beispiel #29
0
		public void prepareForNextTurn() {
			_futureMoveInfo = null;
		}
Beispiel #30
0
		protected void handlePostHitPassiveEffect(MoveQueueItem aItem) {
			aItem.advanceMoveQueueFromState(EMoveQueueItemStatus.HPHitsPassiveEffects);
		}