public AnimeAction CreateHitDamageAction(BattleModel targetModel, AnimationClip hitEffect = null) { SequenceAction sequence = new SequenceAction(); sequence.name = "HitSequence"; if (hitEffect != null) { SimpleAnimationAction effectAction = new SimpleAnimationAction(); effectAction.clip = slashEffect; effectAction.spawnPosition = targetModel.transform.position + new Vector3(0, 1, -2); sequence.AddAction(effectAction); } HitAction hitAction = new HitAction(); hitAction.name = "enemyHit"; hitAction.actor = targetModel; sequence.AddAction(hitAction); HitValueAction damageAction = new HitValueAction(); damageAction.valueTextPrefab = hitValuePrefab; damageAction.hitValue = 1000; damageAction.position = targetModel.transform.position + new Vector3(0, 2, -2); sequence.AddAction(damageAction); return(sequence); }
public void InitData(BattleModel model) { transform.GetText("AbilityAnimation/Active/Text").text = model.Active + ""; transform.GetText("AbilityAnimation/Financial/Text").text = model.Financial + ""; transform.GetText("AbilityAnimation/Resource/Text").text = model.Resource + ""; transform.GetText("AbilityAnimation/Transmission/Text").text = model.Transmission + ""; }
public CombatResult Battle([FromBody] BattleModel battleModel) { var attacker = _monsterCardEntityCrud.GetOne(battleModel.AttackerId); var defender = _monsterCardEntityCrud.GetOne(battleModel.DefenderId); return(BattleCalculator.Attacks((MonsterCard)attacker.CardReference, (MonsterCard)defender.CardReference)); }
public ResultModel Update_Win_Lose(BattleModel b) { var ctx = HttpContext.Current; ResultModel result = new ResultModel(); if (ctx != null) { try { result = dataAccess.Update_Win_Lose_elo(b); if (result.Result > 0) { return(result); } else { return(result); } } catch (Exception) { throw; } } result.Result = -1; result.ResultMessage = "DONT_HAVE_CONTEXT"; return(result); }
public ResultModel update_ranks(BattleModel b, int id) { var ctx = HttpContext.Current; ResultModel result = new ResultModel(); if (ctx != null) { try { result = dataAccess.updateRanks(b, id); if (result.Result > 0) { return(result); } else { return(result); } } catch (Exception) { throw; } } result.Result = -1; result.ResultMessage = "DONT_HAVE_CONTEXT"; return(result); }
/* public HttpResponseMessage Post([FromBody]USER_ACTION u) * { * ResultModel result = respository.create_battle(u); * * var response = Request.CreateResponse<ResultModel>(System.Net.HttpStatusCode.OK, result); * * return response; * }*/ public HttpResponseMessage Post([FromBody] BattleModel b) { ResultModel result = respository.Update_Win_Lose(b); var response = Request.CreateResponse <ResultModel>(System.Net.HttpStatusCode.OK, result); return(response); }
//update ranks // PUT: api/User/5 public HttpResponseMessage Put(int id, [FromBody] BattleModel b) { ResultModel result = respository.update_ranks(b, id); var response = Request.CreateResponse <ResultModel>(System.Net.HttpStatusCode.OK, result); return(response); }
/// <summary> /// 使用自身数据初始化 /// </summary> public void InitFromSelf() { BattleModel battleModel = BattleModel.Inst; instId = battleModel.selfData.instId; pgsHp.max = battleModel.selfData.maxHp; pgsHp.value = battleModel.selfData.curHp; }
public void Bind(BattleModel battleModel, BattleScrollList battleScrollList) { model = battleModel; scrollList = battleScrollList; battleNumText.text = "第" + ConvertHelper.convertNumToStr(model.order) + "关"; battleTitleText.text = model.battleTitle; statusText.text = PrefDefine.BATTLE_STATUS[model.status]; }
public override void DoEffect(BattleManager battlemgr, CardInstance cardInstance, CardEffectTemplate effectTplt, int targetInstId) { BattleModel battleModel = BattleModel.Inst; battleModel.ReduceCost(-effectTplt.iEffectValue); battleModel.effectStat.getCostCount += (uint)effectTplt.iEffectValue; battleModel.roundStat.getCostCount += (uint)effectTplt.iEffectValue; battleModel.battleStat.getCostCount += (uint)effectTplt.iEffectValue; }
public override void Start() { EventDispatcher.AddEventListener(EventConst.UpdateSupporterNum, UpdatePowerData); _model = GetData <BattleModel>(); view.SetFansData(_model.LevelVo, GlobalData.DepartmentData.Fanss); view.SetGoodsData(_model.LevelVo); UpdatePowerData(); }
public AnimeAction CreateHitValueAction(BattleModel targetModel) { HitValueAction damageAction = new HitValueAction(); damageAction.valueTextPrefab = hitValuePrefab; damageAction.hitValue = Random.Range(100, 999); damageAction.position = targetModel.transform.position + new Vector3(0, 2, -2); return(damageAction); }
public void PutBattleData(string fieldData, int attackData) { Debug.Log("PutBattleData"); BattleModel battle = new BattleModel(fieldData, attackData); string json = JsonUtility.ToJson(battle); string date = DateTime.Now.ToString("yyMMddHHmmssfff"); m_referenceBattle.Child(date).SetRawJsonValueAsync(json); }
public AnimeAction CreateEffectAction(BattleModel targetModel, AnimationClip hitEffect) { SimpleAnimationAction effectAction = new SimpleAnimationAction(); effectAction.clip = hitEffect; effectAction.spawnPosition = targetModel.transform.position + new Vector3(0, 1, -2); return(effectAction); }
public override void DoEffect(BattleManager battlemgr, CardInstance cardInstance, CardEffectTemplate effectTplt, int targetInstId) { BattleModel battleModel = BattleModel.Inst; BuffInst decBuff = battleModel.selfData.GetBuffInst((uint)effectTplt.iEffectValue); if (decBuff != null) { battleModel.DecBuffEffectVal(battleModel.selfData, decBuff, effectTplt.iEffectCount); } }
private void InitModel() { _battleModel = BattleModel.Inst; _skillUseY = this.height - frmHand.height - CARD_HEIGHT / 2 + 50; //50为修正偏移 Vector2 globalPos = frmUsedCard.LocalToGlobal(Vector2.zero); _usedCardPos = frmHand.GlobalToLocal(globalPos); }
public override void DoEffect(BattleManager battlemgr, CardInstance cardInstance, CardEffectTemplate effectTplt, int targetInstId) { BattleModel battleModel = BattleModel.Inst; // 如果有脆弱,减少增加的护甲值 int iAddArmor = effectTplt.iEffectValue; iAddArmor = BattleTool.AdjustArmorVal(battleModel.selfData, iAddArmor); battleModel.AddArmor(battleModel.selfData, iAddArmor); return; }
public override void DoEffect(BattleManager battlemgr, CardInstance cardInstance, CardEffectTemplate effectTplt, int targetInstId) { BattleModel battleModel = BattleModel.Inst; int iEffectDamage = (int)battleModel.effectStat.damageLife + (int)battleModel.effectStat.damageArmor; if (iEffectDamage > 0) { battleModel.AddSelfHp(iEffectDamage); } }
public AnimeAction CreateHitAction(BattleModel targetModel) { HitAction action = new HitAction(); action.actor = targetModel; return(action); // SimpleAnimationAction effectAction = new SimpleAnimationAction(); // effectAction.clip = hitEffect; // effectAction.spawnPosition = targetModel.transform.position + new Vector3(0, 1, -2); }
public override void DoEffect(BattleManager battlemgr, CardInstance cardInstance, CardEffectTemplate effectTplt, int targetInstId) { BattleModel battleModel = BattleModel.Inst; BuffInst rmBuff = battleModel.selfData.GetBuffInst((uint)effectTplt.iEffectValue); if (rmBuff != null) { battleModel.RemoveBuff(battleModel.selfData, rmBuff); battleModel.AddBuff(battleModel.selfData, battleModel.selfData, (uint)effectTplt.iEffectValue_2, rmBuff.effectVal); } }
public override void Init() { _model = GetData <BattleModel>(); _model.InitCardList(GlobalData.CardModel.UserCardList); View.SetData(_model.LevelVo, _model); EventDispatcher.AddEventListener <BattleUserCardVo>(EventConst.SmallHeroCardClick, OnSmallHeroCardClick); SendMessage(new Message(MessageConst.TO_GUIDE_BATTLE_SUPERSTAR_START, Message.MessageReciverType.DEFAULT, _model.LevelVo)); }
public void ApplyHiddenStats(EDU.EDU edu, DMB.DMB dmb) { foreach (var descr in unitDescriptions) { Unit unit = edu.FindUnit(descr.internalName); BattleModel bm = dmb.FindBattleModel(unit.soldier.name); int percentile = edu.GetUnitPercentile(unit.type); descr.AddHiddenStats(unit, bm, percentile); } }
// [Test] // public void Die() // { // Debug.Log("###### TEST 2 ######"); // } #region Action public AttackAction CreateAttackAction(BattleModel actor, BattleModel target, short style, bool isMoving, AnimeAction onHitAction) { AttackAction attackAction = new AttackAction(); attackAction.actor = actor; attackAction.style = style; attackAction.isMoving = isMoving; attackAction.targetPostion = target.GetHitPosition() + new Vector3(0, 0, -5); attackAction.onHitAction = onHitAction; return(attackAction); }
public BattleViewModel() { // Create BattleModel object, and set up handler to // react to subsequent changes in BattleModel object. _model = new BattleModel(); _model.BattleModelChanged += BattleModelChangedHandler; // Initialise Command dictionary with commands // for player attacks and game reset. _commands = new Dictionary <string, CommandBase>(); _commands.Add(PlayerAAttackControlID, new AttackCommand(_model, BattleModel.PlayerID.A)); _commands.Add(PlayerBAttackControlID, new AttackCommand(_model, BattleModel.PlayerID.B)); _commands.Add(ResetControlID, new ResetCommand(_model)); }
/// <summary> /// Initializes a new instance of the <see cref="SimulationViewModel"/> class. /// </summary> /// <param name="team1">The first Team.</param> /// <param name="team2">The second Team.</param> public SimulationViewModel(TeamModel team1, TeamModel team2) { this.ticking = false; this.timer.Interval = this.span; this.timer.Tick += this.Timer_Tick; this.clock = new ClockModel(); this.clock.Angle = 0.0; this.TeamA = team1; this.TeamB = team2; this.battleModel = new BattleModel(); this.AddWarriorACommand = new Command(this.AddWarriorA); this.AddWarriorBCommand = new Command(this.AddWarriorB); this.BattleCommand = new Command(this.Battle); }
public void AttackFromTeam(SequenceAction sequence, BattleModel[] attackTeam, BattleModel[] targetTeam) { for (int i = 0; i < attackTeam.Length; i++) { BattleModel actor = attackTeam[i]; BattleModel target = targetTeam[i]; short style = (short)Random.Range(0, 2); AnimeAction attackAttack = CreateAttackAction(actor, target, style, true, CreateHitDamageAction(target, slashEffect[0])); sequence.AddAction(attackAttack); //for(BattleModel actor in attackTeam) { } }
public override void DoEffect(BattleManager battlemgr, CardInstance cardInstance, CardEffectTemplate effectTplt, int targetInstId) { BattleModel battleModel = BattleModel.Inst; if (effectTplt.nTarget == CardEffectTargetType.ONE_ENEMY) { int iDmgCount = BattleTool.GetCardEffectCount(effectTplt); Core.Inst.StartCoroutine(battlemgr.DamageEnemyCoroutine(iDmgCount, targetInstId, effectTplt)); } else if (effectTplt.nTarget == CardEffectTargetType.ALL_ENEMY) { int iDmgCount = BattleTool.GetCardEffectCount(effectTplt); Core.Inst.StartCoroutine(battlemgr.DamageAllEnemyCoroutine(iDmgCount, effectTplt)); } return; }
/// <summary> /// 处理View消息 /// </summary> /// <param name="message"></param> public override void OnMessage(Message message) { string name = message.Name; object[] bodys = message.Params; switch (name) { case MessageConst.CMD_BATTLE_REMOVE_HERO_CARD: _model.SelectedCount--; BattleUserCardVo vo = (BattleUserCardVo)bodys[0]; vo.IsUsed = false; View.RemoveCard(vo); break; case MessageConst.CMD_BATTLE_SUPERSTAR_CONFIRM_ERROR1: FlowText.ShowMessage(I18NManager.Get("SupporterActivity_Hint1")); break; case MessageConst.CMD_BATTLE_SUPERSTAR_CONFIRM: var req = new ChallengeReq(); req.LevelId = _model.LevelVo.LevelId; List <BattleUserCardVo> cards = (List <BattleUserCardVo>)bodys[1]; foreach (var vo1 in cards) { req.CardIds.Add(vo1.UserCardVo.CardId); } BattleModel model = GetData <BattleModel>(); req.Fans.Add(model.FansDict); req.Items.Add(model.ItemsDict); var data = NetWorkManager.GetByteData(req); GetService <BattleService>() .Request(data) .SetCallback(OnGetChallenge, OnChallengeError) .Execute(); break; case MessageConst.GUIDE_BATTLE_SUPERSTAR_CONFIRM: View.Confirm(); break; } }
public virtual bool CanTriggerCardEffect(CardEffectTemplate effectTplt) { if (effectTplt == null) { return(false); } BattleModel battleModel = BattleModel.Inst; switch (effectTplt.iEffectTrigType) { case CardEffectTrigType.NONE: break; case CardEffectTrigType.GIVE_NOT_BLOCK_DAMAGE: if (battleModel.effectStat.damageLife > 0) { return(true); } return(false); case CardEffectTrigType.SELF_HAS_BUFF_TYPE: return(battleModel.selfData.HasBuff(effectTplt.iTrigVal)); case CardEffectTrigType.PRE_EFFECT_DRAW_CARD_TYPE_ATTACK: List <CardInstance> lstDrawCard = battleModel.effectStat.lstDrawCard; if (lstDrawCard.Count > 0 && lstDrawCard[lstDrawCard.Count - 1].cardType == CardType.ATTACK) { return(true); } return(false); case CardEffectTrigType.PRE_EFFECT_KILL_ENEMY: if (battleModel.effectStat.killEnemy) { return(true); } return(false); default: Debug.LogError("unhandle card EffectTrigType:" + effectTplt.iEffectTrigType); break; } return(true); }
public override void OnCharBoutEnd(object obj) { FighterData charData = obj as FighterData; if (0 == charData.armor) { //获得护甲 BattleModel battleModel = BattleModel.Inst; RelicTemplate relicTplt = RelicTemplateData.GetData(this.tplId); if (relicTplt != null) { battleModel.AddArmor(battleModel.selfData, relicTplt.nVal); } } return; }
private void OnBattlePhaseChange(BattleModel.BattlePhase battlePhase) { switch (battlePhase) { case BattleModel.BattlePhase.ActionSelect: this.CreateMenu(_battleModel.CurrentActor); this.ShowCancel(false); break; case BattleModel.BattlePhase.TargetSelect: this.ShowMenu(false); this.ShowCancel(true); break; default: this.ShowCancel(false); this.ShowMenu(false); break; } }
private IEnumerator Start() { var numberOfRows = 4; var numberOfColumns = 3; this._battleView.InitMap(numberOfRows, numberOfColumns, OnTileClick); this._battleModel = new BattleModel(); this.SetupEventListeners(); this._battleModel.CreateBattleMap(numberOfRows, numberOfColumns); yield return 0; this._battleModel.SpawnCharactersOnMap(); yield return 0; this._battleActionMenu.Init(this._battleModel); this._battleModel.ChangePhase(BattleModel.BattlePhase.NextRound); }
public void Init(BattleModel battleModel) { this._battleModel = battleModel; this._battleModel.onBattlePhaseChange += this.OnBattlePhaseChange; }
private void OnBattlePhaseChange(BattleModel.BattlePhase battlePhase) { switch (battlePhase) { default: break; } }