void Update() { if (!holding) { for (int i = 0; i < skillKeys.Length; i++) { if (Input.GetKeyDown(skillKeys[i])) { SkillAttack skillAttack = Skills[i].GetComponent <SkillAttack>(); if (skillAttack.CurrentCool < skillAttack.DecreasedCool) { return; } skillAttack.followMouse = true; smartKeys[i].SetActive(true); holding = true; break; } } } if (holding) { for (int i = 0; i < skillKeys.Length; i++) { if (Input.GetKeyUp(skillKeys[i])) { smartKeys[i].SetActive(false); Skills[i].GetComponent <SkillAttack>().Fire(); holding = false; break; } } } }
/// <summary> /// スキルパネルをセット /// </summary> /// <param name="data"> セットするスキルのデータ</param> public void SetSkill(SkillAttack data) { _skillName.text = data.name; _skillIcon.sprite = data.icon; _skillCost.text = string.Format("CP{0,2:d}", data.cost);; _addAtk.text = string.Format("攻+{0:d}", data.addAtk); }
// Update is called once per frame public void ManualUpdate() { if (!isActive) { return; } int activeAttackCount = 0; for (int i = 0; i < attackList.Count; i++) { SkillAttack att = attackList[i]; if (att.isFinished) { activeAttackCount++; } else { att.ManualUpdate(); } } //攻击虽然结束了,但是连击还有连击,技能不应该销毁 if (activeAttackCount == attackList.Count) { isActive = false; Destroy(); } LateManualUpdate(); }
//提高第一击的移动速度 protected override void AfterDoCurAttack(SkillAttack curAttack) { if (attackList.Count > 1) { SkillAttack preAttack = attackList[0]; preAttack.AttackEnd(); } }
public void DoCurAttack() { //以后再考虑要不要做缓存池 SkillAttack attack = new SkillAttack(); attack.StartAttack(this, actor, curAttackConf); attackList.Add(attack); AfterDoCurAttack(attack); }
public void OnAttackEnd(SkillAttack sa) { if (sa == attackList[attackList.Count - 1]) { if (sa.attackConf.autoNextAttack) { PlaySkill_AutoNextAttack(); } } }
private static void HandleRegionSkills(GameSession session, PacketReader packet) { long skillSn = packet.ReadLong(); byte mode = packet.ReadByte(); int unknown = packet.ReadInt(); int attackIndex = packet.ReadInt(); CoordF position = packet.Read <CoordF>(); CoordF rotation = packet.Read <CoordF>(); // What are these values used? Check client vs server? // TODO: Verify rest of skills to proc correctly. // TODO: Send status correctly when Region attacks are proc. SkillCast parentSkill = session.Player.FieldPlayer.SkillCast; if (parentSkill is null || parentSkill.SkillSn != skillSn) { return; } SkillAttack skillAttack = parentSkill.GetSkillMotions().FirstOrDefault()?.SkillAttacks.FirstOrDefault(); if (skillAttack is null) { return; } if (skillAttack.CubeMagicPathId == 0 && skillAttack.MagicPathId == 0) { return; } SkillCondition skillCondition = skillAttack.SkillConditions.FirstOrDefault(x => x.IsSplash); if (skillCondition is null) { return; } SkillCast skillCast = new(skillCondition.SkillId, skillCondition.SkillLevel, GuidGenerator.Long(), session.ServerTick, parentSkill) { CasterObjectId = session.Player.FieldPlayer.ObjectId, SkillAttack = skillAttack, Duration = skillCondition.FireCount * 1000, Interval = skillCondition.Interval }; RegionSkillHandler.HandleEffect(session, skillCast, attackIndex); } #endregion }
protected void AddTeam(int id, ETeamType type) { var team = new TeamController(); team.TeamType = type; m_TeamList.Add(team); if (type == ETeamType.LeftSide) { var pupilId = AdventureProxy.instance.GetData().PupilId; var pupilInfo = PupilProxy.instance.getPupilInfo(pupilId); var wuxue = pupilInfo.GetEquipingWuXue(); var character = team.AddCharacter(1, pupilId); character.TeamType = type; character.InitHp(200, 200); character.SkillId = wuxue != null ? wuxue.Id : 0; var normalAttack = new NormalAttack(); normalAttack.AttackCount = 1; normalAttack.AttackHurt = 20; normalAttack.AttackTarget = null; character.InitNormalAttack(normalAttack); var skillAttack = new SkillAttack(); skillAttack.AttackCount = 4; skillAttack.AttackHurt = 10; skillAttack.AttackTarget = null; skillAttack.SkillId = character.SkillId; character.InitSkillAttack(skillAttack); } else { var character = team.AddCharacter(2, m_EnemyId); character.TeamType = type; character.InitHp(200, 200); character.SkillId = EnemyDeploy.GetInfo(m_EnemyId).SkillEffectId; var normalAttack = new NormalAttack(); normalAttack.AttackCount = 1; normalAttack.AttackHurt = 10; normalAttack.AttackTarget = null; character.InitNormalAttack(normalAttack); var skillAttack = new SkillAttack(); skillAttack.AttackCount = 4; skillAttack.AttackHurt = 5; skillAttack.AttackTarget = null; skillAttack.SkillId = character.SkillId; character.InitSkillAttack(skillAttack); } }
//进入第二阶段后,积攒血气,curAttackIndex == 1 //初始就有一截,后面还差4截,满5截后转换为血刃 // //EffectFly 组件 protected override void LateManualUpdate() { //第二击完成后,显示第一截剑体 if (curAttackIndex == 1 && curGrowStep == 0) { SkillAttack attack = attackList[curAttackIndex]; //if(attack.isEffectPlayEnd) { EffectObject eo = EffectManager.GetEffect(growingSwordBloodEffectName, actor.transform); eo.effectObject.realLocalPos = attack.eo.effectObject.realLocalPos + new Vector3(0, growingSwordBloodStartPos, 0); growingSwardArray[curGrowStep++] = eo; } } }
public void start() { if (data.skillAttackDatas != null) { skillAttacks = new SkillAttack[data.skillAttackDatas.Length]; for (var i = 0; i < data.skillAttackDatas.Length; i++) { var sad = data.skillAttackDatas[i]; var bindBone = from.GetComponent <Status>().animator.GetBoneTransform(sad.bindname); if (bindBone == null) { bindBone = from.transform; } var sa = new SkillAttack(); sa.data = sad; sa.start(bindBone, from); skillAttacks[i] = sa; } } }
void CreateActionButtons() { GameObject attackButton = Instantiate(actionButton) as GameObject; Text attackButtonText = attackButton.transform.Find("Text").gameObject.GetComponent <Text>(); attackButtonText.text = "Attack"; attackButton.GetComponent <Button>().onClick.AddListener(() => Attack()); attackButton.transform.SetParent(actionSpacer, false); attackButtons.Add(attackButton); GameObject skillsButton = Instantiate(actionButton) as GameObject; Text skillsButtonText = skillsButton.transform.Find("Text").gameObject.GetComponent <Text>(); skillsButtonText.text = "Skills"; skillsButton.GetComponent <Button>().onClick.AddListener(() => selectSkill()); skillsButton.transform.SetParent(actionSpacer, false); attackButtons.Add(skillsButton); GameObject formsButton = Instantiate(actionButton) as GameObject; Text formsButtonText = formsButton.transform.Find("Text").gameObject.GetComponent <Text>(); formsButtonText.text = "Forms"; formsButton.GetComponent <Button>().onClick.AddListener(() => SelectForm()); formsButton.transform.SetParent(actionSpacer, false); attackButtons.Add(formsButton); GameObject itemsButton = Instantiate(actionButton) as GameObject; Text itemsButtonText = itemsButton.transform.Find("Text").gameObject.GetComponent <Text>(); itemsButtonText.text = "Items"; itemsButton.GetComponent <Button>().onClick.AddListener(() => SelectItem()); itemsButton.transform.SetParent(actionSpacer, false); attackButtons.Add(itemsButton); GameObject fleeButton = Instantiate(actionButton) as GameObject; Text fleeButtonText = fleeButton.transform.Find("Text").gameObject.GetComponent <Text>(); fleeButtonText.text = "Flee"; fleeButton.GetComponent <Button>().onClick.AddListener(() => Flee()); fleeButton.transform.SetParent(actionSpacer, false); attackButtons.Add(fleeButton); GameObject loseButton = Instantiate(actionButton) as GameObject; Text loseButtonText = loseButton.transform.Find("Text").gameObject.GetComponent <Text>(); loseButtonText.text = "Lose"; loseButton.GetComponent <Button>().onClick.AddListener(() => Lose()); loseButton.transform.SetParent(actionSpacer, false); attackButtons.Add(loseButton); if (heroManageList[0].GetComponent <PCStateMachine>().playerCharacter.skillList.Count > 0) { foreach (Attack skill in heroManageList[0].GetComponent <PCStateMachine>().playerCharacter.skillList) { if (skill.learned) { GameObject addSkillButton = Instantiate(skillButton) as GameObject; Text skillButtonText = addSkillButton.transform.Find("Text").gameObject.GetComponent <Text>(); skillButtonText.text = skill.attackName; SkillAttack sB = skillButton.GetComponent <SkillAttack>(); sB.skillToPerform = skill; addSkillButton.transform.SetParent(skillsSpacer, false); attackButtons.Add(addSkillButton); } } } else { skillsButton.GetComponent <Button>().interactable = false; } if (heroManageList[0].GetComponent <PCStateMachine>().playerCharacter.formList.Count > 0) { foreach (Form form in heroManageList[0].GetComponent <PCStateMachine>().playerCharacter.formList) { GameObject addFormButton = Instantiate(formButton) as GameObject; Text formButtonText = addFormButton.transform.Find("Text").gameObject.GetComponent <Text>(); formButtonText.text = form.formName; FormAttack fB = formButton.GetComponent <FormAttack>(); fB.formToEnter = form; addFormButton.transform.SetParent(formsSpacer, false); attackButtons.Add(addFormButton); } } else { formsButton.GetComponent <Button>().interactable = false; } if (heroManageList[0].GetComponent <PCStateMachine>().playerCharacter.itemList.Count > 0) { foreach (Item item in heroManageList[0].GetComponent <PCStateMachine>().playerCharacter.itemList) { if (item.itemCount > 0) { GameObject addItemButton = Instantiate(itemButton) as GameObject; Text itemButtonText = addItemButton.transform.Find("Text").gameObject.GetComponent <Text>(); itemButtonText.text = item.itemName; ItemAttack iB = itemButton.GetComponent <ItemAttack>(); iB.itemToUse = item; addItemButton.transform.SetParent(itemsSpacer, false); attackButtons.Add(addItemButton); } } } else { itemsButton.GetComponent <Button>().interactable = false; } }
protected override List <SkillMetadata> Parse() { List <SkillMetadata> skillList = new List <SkillMetadata>(); foreach (PackFileEntry entry in Resources.XmlReader.Files) { // Parsing Skills if (entry.Name.StartsWith("skill")) { XmlDocument document = Resources.XmlReader.GetXmlDocument(entry); XmlNode ui = document.SelectSingleNode("/ms2/basic/ui"); XmlNode kinds = document.SelectSingleNode("/ms2/basic/kinds"); XmlNode stateAttr = document.SelectSingleNode("/ms2/basic/stateAttr"); XmlNodeList levels = document.SelectNodes("/ms2/level"); int skillId = int.Parse(Path.GetFileNameWithoutExtension(entry.Name)); string skillState = kinds.Attributes["state"]?.Value ?? ""; byte skillAttackType = byte.Parse(ui.Attributes["attackType"]?.Value ?? "0"); byte skillType = byte.Parse(kinds.Attributes["type"].Value); byte skillSubType = byte.Parse(kinds.Attributes["subType"]?.Value ?? "0"); byte skillElement = byte.Parse(kinds.Attributes["element"].Value); byte skillSuperArmor = byte.Parse(stateAttr.Attributes["superArmor"].Value); bool skillRecovery = int.Parse(kinds.Attributes["spRecoverySkill"]?.Value ?? "0") == 1; List <SkillLevel> skillLevels = new List <SkillLevel>(); foreach (XmlNode level in levels) { // Getting all skills level string feature = level.Attributes["feature"]?.Value ?? ""; int levelValue = int.Parse(level.Attributes["value"].Value ?? "0"); // We prevent duplicates levels from older balances. if (skillLevels.Exists(level => level.Level == levelValue)) { continue; } int spirit = int.Parse(level.SelectSingleNode("consume/stat").Attributes["sp"]?.Value ?? "0"); int stamina = int.Parse(level.SelectSingleNode("consume/stat").Attributes["ep"]?.Value ?? "0"); float damageRate = float.Parse(level.SelectSingleNode("motion/attack/damageProperty")?.Attributes["rate"].Value ?? "0"); string sequenceName = level.SelectSingleNode("motion/motionProperty")?.Attributes["sequenceName"].Value ?? ""; string motionEffect = level.SelectSingleNode("motion/motionProperty")?.Attributes["motionEffect"].Value ?? ""; SkillUpgrade skillUpgrade = new SkillUpgrade(); if (level.SelectSingleNode("motion/upgrade")?.Attributes != null) { int upgradeLevel = int.Parse(level.SelectSingleNode("motion/upgrade").Attributes["level"].Value ?? "0"); int[] upgradeSkills = level.SelectSingleNode("motion/upgrade").Attributes["skillIDs"].Value.Split(",").Select(int.Parse).ToArray(); short[] upgradeSkillsLevel = level.SelectSingleNode("motion/upgrade").Attributes["skillLevels"].Value.Split(",").Select(short.Parse).ToArray(); skillUpgrade = new SkillUpgrade(upgradeLevel, upgradeSkills, upgradeSkillsLevel); } // Getting all Attack attr in each level. List <SkillAttack> skillAttacks = new List <SkillAttack>(); List <SkillCondition> skillConditions = new List <SkillCondition>(); XmlNodeList conditionSkills = level.SelectNodes("motion/attack/conditionSkill") ?? level.SelectNodes("conditionSkill"); foreach (XmlNode conditionSkill in conditionSkills) { int conditionSkillId = int.Parse(conditionSkill.Attributes["skillID"]?.Value ?? "0"); short conditionSkillLevel = short.Parse(conditionSkill.Attributes["level"]?.Value ?? "0"); bool splash = conditionSkill.Attributes["splash"]?.Value == "1"; byte target = byte.Parse(conditionSkill.Attributes["skillTarget"].Value ?? "0"); byte owner = byte.Parse(conditionSkill.Attributes["skillOwner"]?.Value ?? "0"); SkillCondition skillCondition = new SkillCondition(conditionSkillId, conditionSkillLevel, splash, target, owner); skillConditions.Add(skillCondition); } XmlNodeList attackListAttr = level.SelectNodes("motion/attack"); foreach (XmlNode attackAttr in attackListAttr) { // Many skills has a condition to proc another skill. // We capture that as a list, since each Attack attr has one at least. byte attackPoint = byte.Parse(Regex.Match(attackAttr.Attributes["point"]?.Value, @"\d").Value); short targetCount = short.Parse(attackAttr.Attributes["targetCount"].Value); long magicPathId = long.Parse(attackAttr.Attributes["magicPathID"]?.Value ?? "0"); long cubeMagicPathId = long.Parse(attackAttr.Attributes["cubeMagicPathID"]?.Value ?? "0"); SkillAttack skillAttack = new SkillAttack(attackPoint, targetCount, magicPathId, cubeMagicPathId); skillAttacks.Add(skillAttack); } SkillMotion skillMotion = new SkillMotion(sequenceName, motionEffect); SkillLevel skillLevel = new SkillLevel(levelValue, spirit, stamina, damageRate, feature, skillMotion, skillAttacks, skillConditions, skillUpgrade); skillLevels.Add(skillLevel); } skillList.Add(new SkillMetadata(skillId, skillLevels, skillState, skillAttackType, skillType, skillSubType, skillElement, skillSuperArmor, skillRecovery)); continue; } // Parsing SubSkills if (entry.Name.StartsWith("table/job")) { XmlDocument document = Resources.XmlReader.GetXmlDocument(entry); XmlNodeList jobs = document.SelectNodes("/ms2/job"); foreach (XmlNode job in jobs) { // Grabs all the skills and them the jobCode. XmlNodeList skills = job.SelectNodes("skills/skill"); int jobCode = int.Parse(job.Attributes["code"].Value); foreach (XmlNode skill in skills) { int id = int.Parse(skill.Attributes["main"].Value); short maxLevel = short.Parse(skill.Attributes["maxLevel"]?.Value ?? "1"); skillList.Find(x => x.SkillId == id).Job = jobCode; skillList.Find(x => x.SkillId == id).MaxLevel = maxLevel; // If it has subSkill, add as well. if (skill.Attributes["sub"] == null) { continue; } int[] sub = skill.Attributes["sub"].Value.Split(",").Select(int.Parse).ToArray(); skillList.Find(x => x.SkillId == id).SubSkills = sub; for (int n = 0; n < sub.Length; n++) { if (skillList.Select(x => x.SkillId).Contains(sub[n])) { skillList.Find(x => x.SkillId == sub[n]).Job = jobCode; } } } XmlNodeList learnSkills = job.SelectNodes("learn/skill"); foreach (XmlNode learnSkill in learnSkills) { int id = int.Parse(learnSkill.Attributes["id"].Value); skillList.Find(x => x.SkillId == id).CurrentLevel = 1; } } } } // Parsing Additional Data foreach (PackFileEntry entry in Resources.XmlReader.Files) { if (!entry.Name.StartsWith("additionaleffect")) { continue; } XmlDocument document = Resources.XmlReader.GetXmlDocument(entry); XmlNodeList levels = document.SelectNodes("/ms2/level"); int skillId = int.Parse(Path.GetFileNameWithoutExtension(entry.Name)); List <SkillLevel> skillLevels = new List <SkillLevel>(); if (skillList.Select(x => x.SkillId).Contains(skillId)) { foreach (XmlNode level in levels) { int currentLevel = int.Parse(level.SelectSingleNode("BasicProperty").Attributes["level"]?.Value ?? "0"); skillLevels = skillList.Find(x => x.SkillId == skillId).SkillLevels; if (skillLevels.Select(x => x.Level).Contains(currentLevel)) { skillLevels.Find(x => x.Level == currentLevel).SkillAdditionalData = ParseSkillData(level); } } continue; } // Adding missing skills from additionaleffect. // Since they are many skills that are called by another skill and not from player directly. foreach (XmlNode level in levels) { int currentLevel = int.Parse(level.SelectSingleNode("BasicProperty").Attributes["level"]?.Value ?? "0"); skillLevels.Add(new SkillLevel(currentLevel, ParseSkillData(level))); } skillList.Add(new SkillMetadata(skillId, skillLevels)); } return(skillList); }
protected virtual void AfterDoCurAttack(SkillAttack curAttack) { }
private void Awake() { skillAttack = GetComponent <SkillAttack>(); }
protected override void AfterDoCurAttack(SkillAttack curAttack) { }
/// <summary> /// Get the coordinates of the skill's effect, if needed change the offset to match the direction of the player. /// For skills that paint the ground, match the correct height. /// </summary> private static List <CoordF> GetEffectCoords(SkillCast skillCast, int mapId, int attackIndex) { SkillAttack skillAttack = skillCast.SkillAttack; List <MagicPathMove> cubeMagicPathMoves = new(); List <MagicPathMove> magicPathMoves = new(); if (skillAttack.CubeMagicPathId != 0) { cubeMagicPathMoves.AddRange(MagicPathMetadataStorage.GetMagicPath(skillAttack.CubeMagicPathId)?.MagicPathMoves ?? new()); } if (skillAttack.MagicPathId != 0) { magicPathMoves.AddRange(MagicPathMetadataStorage.GetMagicPath(skillAttack.MagicPathId)?.MagicPathMoves ?? new()); } int skillMovesCount = cubeMagicPathMoves.Count + magicPathMoves.Count; List <CoordF> effectCoords = new(); if (skillMovesCount <= 0) { effectCoords.Add(skillCast.Position); return(effectCoords); } // TODO: Handle case where magicPathMoves and cubeMagicPathMoves counts are > 0 // Basically do the next if, with the later for loop if (magicPathMoves.Count > 0) { MagicPathMove magicPathMove = magicPathMoves[attackIndex]; IFieldActor <NpcMetadata> parentSkillTarget = skillCast.ParentSkill.Target; if (parentSkillTarget is not null) { effectCoords.Add(parentSkillTarget.Coord); return(effectCoords); } // Rotate the offset coord and distance based on the look direction CoordF rotatedOffset = CoordF.From(magicPathMove.FireOffsetPosition.Length(), skillCast.LookDirection); CoordF distance = CoordF.From(magicPathMove.Distance, skillCast.LookDirection); // Create new effect coord based on offset rotation and distance effectCoords.Add(rotatedOffset + distance + skillCast.Position); return(effectCoords); } // Adjust the effect on the destination/cube foreach (MagicPathMove cubeMagicPathMove in cubeMagicPathMoves) { CoordF offSetCoord = cubeMagicPathMove.FireOffsetPosition; // If false, rotate the offset based on the look direction. Example: Wizard's Tornado if (!cubeMagicPathMove.IgnoreAdjust) { // Rotate the offset coord based on the look direction CoordF rotatedOffset = CoordF.From(offSetCoord.Length(), skillCast.LookDirection); // Create new effect coord based on offset rotation and source coord effectCoords.Add(rotatedOffset + skillCast.Position); continue; } offSetCoord += Block.ClosestBlock(skillCast.Position); CoordS tempBlockCoord = offSetCoord.ToShort(); // Set the height to the max allowed, which is one block above the cast coord. tempBlockCoord.Z += Block.BLOCK_SIZE * 2; // Find the first block below the effect coord int distanceToNextBlockBelow = MapMetadataStorage.GetDistanceToNextBlockBelow(mapId, offSetCoord.ToShort(), out MapBlock blockBelow); // If the block is null or the distance from the cast effect Z height is greater than two blocks, continue if (blockBelow is null || distanceToNextBlockBelow > Block.BLOCK_SIZE * 2) { continue; } // If there is a block above, continue if (MapMetadataStorage.BlockAboveExists(mapId, blockBelow.Coord)) { continue; } // If block is liquid, continue if (MapMetadataStorage.IsLiquidBlock(blockBelow)) { continue; } // Since this is the block below, add 150 units to the Z coord so the effect is above the block offSetCoord = blockBelow.Coord.ToFloat(); offSetCoord.Z += Block.BLOCK_SIZE; effectCoords.Add(offSetCoord); } return(effectCoords); }
/// <summary> /// /// </summary> /// <param name="RobotQQ">机器人QQ 多Q版用于判定哪个QQ接收到该消息</param> /// <param name="MsgType">消息类型 接收到消息类型,该类型可在常量表中查询具体定义,此处仅列举: - 1 未定义事件 1 好友信息 2, 群信息 3, 讨论组信息 4, 群临时会话 5, 讨论组临时会话 6, 财付通转账</param> /// <param name="MsgCType">消息子类型 此参数在不同消息类型下,有不同的定义,暂定:接收财付通转账时 1为好友 2为群临时会话 3为讨论组临时会话 有人请求入群时,不良成员这里为1</param> /// <param name="MsgFrom">消息来源 此消息的来源,如:群号、讨论组ID、临时会话QQ、好友QQ等</param> /// <param name="TigObjF">触发对象_主动 主动发送这条消息的QQ,踢人时为踢人管理员QQ</param> /// <param name="TigObjC">触发对象_被动 被动触发的QQ,如某人被踢出群,则此参数为被踢出人QQ</param> /// <param name="Msg">消息内容 此参数有多重含义,常见为:对方发送的消息内容,但当IRC_消息类型为 某人申请入群,则为入群申请理由</param> /// <param name="MsgNum">消息序号 此参数暂定用于消息回复,消息撤回</param> /// <param name="MsgID">消息ID 此参数暂定用于消息撤回</param> /// <param name="RawMsg">原始信息 UDP收到的原始信息,特殊情况下会返回JSON结构(收到群验证事件时,这里为该事件seq)</param> /// <param name="Json">Json信息 JSON格式转账解析</param> /// <param name="pText">信息回传文本指针 此参数用于插件加载拒绝理由 用法:写到内存(“拒绝理由”,IRC_信息回传文本指针_Out)</param> /// <returns></returns> ///此子程序会分发IRC_机器人QQ接收到的所有:事件,消息;您可在此函数中自行调用所有参数 public static int IR_Event(string RobotQQ, int MsgType, int MsgCType, string MsgFrom, string TigObjF, string TigObjC, string Msg, string MsgNum, string MsgID, string RawMsg, string Json, int pText) { if (MsgType == 1) { //IRQQApi.Api_SendMsg(RobotQQ, 1, "", MsgFrom, "发送的消息为:"+Msg, 0); //string sPicLink = IRQQApi.Api_GetPicLink(RobotQQ, 2, "1", Msg); //IRQQApi.Api_SendMsg(RobotQQ, 1, "", MsgFrom, "图片链接为:" + sPicLink, 0); } else if (MsgType == 2) { if (Msg == "#帮助") { IRQQApi.Api_SendMsg(RobotQQ, 2, MsgFrom, "", "[IR:at=" + TigObjF + "]" + "#查询 查询你当前的雷币数量\n#查属性+[空格]+[属性名] 查询当前属性(目前仅开放了[幸运]属性)\n" + "#洗属性+[空格]+[属性名] 花费300雷币重置当前属性(目前仅开放了[幸运]属性)\n" + "#查技能 查看当前装备的技能\n" + "#洗技能 花费300雷币重置当前技能数值\n" + "*[幸运]属性会影响所有的几率事件", -1); } else if (Msg == "#查询") { var oldGold = CurdToDB.SearchGoldFromDB(TigObjF); IRQQUtil.WritePluginLogFile(logfile, "\n查询结果" + oldGold + "," + DateTime.Now); if (oldGold == -1) { //string nickname = IRQQApi.Api_GetGroupCard(RobotQQ, MsgFrom, TigObjF); IRQQApi.Api_SendMsg(RobotQQ, 2, MsgFrom, "", "[IR:at=" + TigObjF + "]" + "你没创建人物!随便说一句话就自动创建人物辣!!", -1); } else { //string nickname = IRQQApi.Api_GetGroupCard(RobotQQ, MsgFrom, TigObjF); IRQQApi.Api_SendMsg(RobotQQ, 2, MsgFrom, "", "[IR:at=" + TigObjF + "]" + " 当前拥有" + oldGold + "个穆雷币!", -1); } } else if (Msg == "#洗属性 幸运") { int iResult; iResult = CurdToDB.SearchGoldFromDB(TigObjF); if (iResult == -1) { IRQQApi.Api_SendMsg(RobotQQ, 2, MsgFrom, "", "[IR:at=" + TigObjF + "]" + "没有你的角色!先发言创建角色吧!", -1); } else if (iResult >= 300) { Random rd = new Random(); int iLucky = rd.Next(1, 101); CurdToDB.UpdateGoldToDB(TigObjF, iResult, -300); CurdToDB.UpdateLuckyToDB(TigObjF, iLucky); IRQQApi.Api_SendMsg(RobotQQ, 2, MsgFrom, "", "[IR:at=" + TigObjF + "]" + "洗属性成功!你现在的幸运值为:" + iLucky + "点", -1); } else { IRQQApi.Api_SendMsg(RobotQQ, 2, MsgFrom, "", "[IR:at=" + TigObjF + "]" + "你的雷币不够!洗属性需要300雷币,努力发言赚雷币吧", -1); } } else if (Msg == "#查属性 幸运") { int iResult; iResult = CurdToDB.SearchLuckyFromDB(TigObjF); if (iResult != -1) { IRQQApi.Api_SendMsg(RobotQQ, 2, MsgFrom, "", "[IR:at=" + TigObjF + "]" + " 你的幸运值为:" + iResult + "点", -1); } else { IRQQApi.Api_SendMsg(RobotQQ, 2, MsgFrom, "", "[IR:at=" + TigObjF + "]" + " 你没创建人物!随便说一句话就自动创建人物辣!!", -1); } } else if (Msg == "#轮盘") { //int oldGold = CurdToDB.SearchGoldFromDB(TigObjF); //if (oldGold>=50) //{ // string iResult = IRQQMain.StartRollClub(TigObjF, MsgFrom); // if (iResult == "0") // { // //发起了 // CurdToDB.UpdateGoldToDB(TigObjF, oldGold, -50); // oldGold = oldGold - 50; // IRQQApi.Api_SendMsg(RobotQQ, 2, MsgFrom, "", "[IR:at=" + TigObjF + "]" + " 你花费50雷币 发起了 轮盘游戏!还缺4个人报名!\n你现在剩余"+ oldGold+"雷币!", -1); // } // else if (iResult.Length > 2) // { // //获胜 // CurdToDB.UpdateGoldToDB(TigObjF, oldGold, -50); // oldGold = oldGold - 50; // IRQQApi.Api_SendMsg(RobotQQ, 2, MsgFrom, "", "[IR:at=" + TigObjF + "]" + " 你现在剩余" + oldGold + "雷币!\n人满了开始抽奖!", -1); // int winOldGold = CurdToDB.SearchGoldFromDB(iResult); // CurdToDB.UpdateGoldToDB(iResult, winOldGold, 250); // int winGold = winOldGold + 250; // IRQQApi.Api_SendMsg(RobotQQ, 2, MsgFrom, "", "[IR:at=" + iResult + "]" + " 你中奖啦!!!那4个弟弟的雷币归你了!雷币+250!\n你现在剩余" + winGold + "雷币!", -1); // } // else if (iResult != "-1") // { // //参加 // CurdToDB.UpdateGoldToDB(TigObjF, oldGold, -50); // int iplay = 5 - int.Parse(iResult); // oldGold = oldGold - 50; // IRQQApi.Api_SendMsg(RobotQQ, 2, MsgFrom, "", "[IR:at=" + TigObjF + "]" + " 你花费50雷币 加入了 轮盘游戏!还缺" + iplay + "个人报名!\n你现在剩余" + oldGold + "雷币!", -1); // } // else if (iResult=="-1") // { // //出错了 // IRQQApi.Api_SendMsg(RobotQQ, 2, MsgFrom, "", "[IR:at=" + TigObjF + "]" + " 不知道为什么轮盘游戏好像出错了!\n找GM吧!", -1); // } //} //else //{ // //钱不够 // IRQQApi.Api_SendMsg(RobotQQ, 2, MsgFrom, "", "[IR:at=" + TigObjF + "]" + " 你的雷币不够50!", -1); //} } else if (Msg == "#查技能") { SkillThief skillThief = new SkillThief(); skillThief = CurdToDB.SearchSkillThiefFromDB(TigObjF); if (skillThief == null) { //没有技能 IRQQApi.Api_SendMsg(RobotQQ, 2, MsgFrom, "", "[IR:at=" + TigObjF + "]" + "你还不会任何技能!", -1); } else { //有技能 IRQQApi.Api_SendMsg(RobotQQ, 2, MsgFrom, "", "[IR:at=" + TigObjF + "]" + "偷窃:随机偷取一名玩家随机数量的雷币\n" + "触发几率:" + skillThief.SkillChance + "%\n" + "偷窃范围:" + skillThief.EffLower + " - " + skillThief.EffUpper, -1); } } else if (Msg == "#洗技能") { SkillThief skillThief = new SkillThief(); skillThief = CurdToDB.SearchSkillThiefFromDB(TigObjF); if (skillThief == null) { //没有技能 IRQQApi.Api_SendMsg(RobotQQ, 2, MsgFrom, "", "[IR:at=" + TigObjF + "]" + "你还不会任何技能!", -1); } else { var oldGold = CurdToDB.SearchGoldFromDB(TigObjF); IRQQUtil.WritePluginLogFile(logfile, "\n查询结果" + oldGold + "," + DateTime.Now); if (oldGold == -1) { IRQQApi.Api_SendMsg(RobotQQ, 2, MsgFrom, "", "[IR:at=" + TigObjF + "]" + "你没创建人物!随便说一句话就自动创建人物辣!!", -1); } else if (oldGold < 300) { IRQQApi.Api_SendMsg(RobotQQ, 2, MsgFrom, "", "[IR:at=" + TigObjF + "]" + " 当前拥有" + oldGold + "个穆雷币!\n" + " 洗技能需要300雷币!", -1); } else { CurdToDB.UpdateGoldToDB(TigObjF, oldGold, -300); double luckyAddon = LuckyAddon.GetiLuckyAddon(TigObjF); Random random = new Random(); int skillChance; int effLower; int effUpper; int effRange; skillChance = random.Next(1, (int)(6 * luckyAddon)); effLower = random.Next(0, (int)(41 * luckyAddon)); effRange = random.Next(1, (int)(41 * luckyAddon)); effUpper = effLower + effRange; bool iBool = CurdToDB.UpdateSkillThiefToDB(TigObjF, skillChance, effLower, effUpper); if (iBool) { IRQQApi.Api_SendMsg(RobotQQ, 2, MsgFrom, "", "[IR:at=" + TigObjF + "]" + "洗技能成功!\n" + "偷窃:随机偷取一名玩家随机数量的雷币\n" + "触发几率:" + skillChance + "%\n" + "偷窃范围:" + effLower + " - " + effUpper, -1); } else { IRQQApi.Api_SendMsg(RobotQQ, 2, MsgFrom, "", "[IR:at=" + TigObjF + "]" + "不知道为什么洗技能失败了,联系GM吧!", -1); } } } } else if (Msg.Length > 2) { int iGold = GetGolds.DefaultGetGold(TigObjF); if (iGold == -1) { return(1); } else if (iGold > 1000) { string nickname = IRQQApi.Api_GetGroupCard(RobotQQ, MsgFrom, TigObjF); IRQQApi.Api_SendMsg(RobotQQ, 2, MsgFrom, "", "[IR:at=" + TigObjF + "]" + " 你就是天选之人?" + nickname + "击败Boss爆了一个藏宝图,找到了宝藏,共计获得了" + iGold + "个雷币!", -1); } else if (iGold > 100) { //string nickname = IRQQApi.Api_GetGroupCard(RobotQQ, MsgFrom, TigObjF); IRQQApi.Api_SendMsg(RobotQQ, 2, MsgFrom, "", "[IR:at=" + TigObjF + "]" + " 打怪爆了一个金闪闪的钥匙,打开怪物的保险柜后收获了" + iGold + "个雷币!", -1); } else if (iGold > 10) { //string nickname = IRQQApi.Api_GetGroupCard(RobotQQ, MsgFrom, TigObjF); IRQQApi.Api_SendMsg(RobotQQ, 2, MsgFrom, "", "[IR:at=" + TigObjF + "]" + " 在村民家的保险箱中摸到了" + iGold + "个雷币!", -1); } //判断是否获得技能 SkillThief skillThief = new SkillThief(); skillThief = GetGolds.DefaultGetSkill(TigObjF); if (skillThief != null) { IRQQApi.Api_SendMsg(RobotQQ, 2, MsgFrom, "", "[IR:at=" + TigObjF + "]" + " 击杀了一只稀有精英怪,获得了一本盗贼技能书.\n偷窃:随机偷取一名玩家随机数量的雷币\n" + "触发几率:" + skillThief.SkillChance + "%\n" + "偷窃范围:" + skillThief.EffLower + " - " + skillThief.EffUpper, -1); } //释放技能 ThiefAttack thiefAttack = new ThiefAttack(); thiefAttack = SkillAttack.ThiefSkillAttack(TigObjF); if (thiefAttack != null) { if (TigObjF == thiefAttack.QQid) { IRQQApi.Api_SendMsg(RobotQQ, 2, MsgFrom, "", "[IR:at=" + TigObjF + "]" + " 幸运的释放了偷窃技能,但不幸的是目标是自己\n" + "将" + thiefAttack.ThiefGold + "个穆雷币从左口袋放进了右口袋", -1); } else { IRQQApi.Api_SendMsg(RobotQQ, 2, MsgFrom, "", "[IR:at=" + TigObjF + "]" + " 幸运的释放了偷窃技能,偷走了" + "[IR:at=" + thiefAttack.QQid + "]" + " " + thiefAttack.ThiefGold + "个雷币!!", -1); } } } else { return(1); } } else if (MsgType == 3) { } //IRQQApi.Api_SendGroupMsg(RobotQQ,MsgFrom, "♪"); //发送图片 //String picPath = AppDomain.CurrentDomain.BaseDirectory + "1.jpg"; //IRQQApi.Api_SendMsg(RobotQQ, MsgType, MsgFrom, TigObjF, IRQQConst.getPic(picPath), -1); return(1); }
private void ChangeStatus(EmActorStatus s) { if (curStatus == s && s != EmActorStatus.DoAttack) { Debug.LogWarning("Reset staus: " + s); } timer = 0; switch (s) { case EmActorStatus.Idle: statusDuration = PlayAnimation(EmActorAnimationName.Idle); break; case EmActorStatus.Walk: statusDuration = PlayAnimation(EmActorAnimationName.Walk); break; case EmActorStatus.Run: statusDuration = PlayAnimation(EmActorAnimationName.Run); break; case EmActorStatus.Jump: moveDirection = Vector3.zero; curFallSpeed = curAttribute.jumpYSpeed; PlayAnimation(EmActorAnimationName.Jump); break; case EmActorStatus.JumpHigh_Up: moveDirection = Vector3.zero; curFallSpeed = curAttribute.jumpYSpeed; PlayAnimation(EmActorAnimationName.JumpHigh_Up); break; case EmActorStatus.JumpHigh_Down: moveDirection = Vector3.zero; PlayAnimation(EmActorAnimationName.JumpHigh_Down); break; case EmActorStatus.JumpBack: moveDirection = Vector3.zero; curFallSpeed = curAttribute.jumpBackYSpeed; statusDuration = PlayAnimation(EmActorAnimationName.JumpBack); break; case EmActorStatus.CastAttackChargeStart: statusDuration = PlayAnimation(EmActorAnimationName.CastAttackChargeStart); break; case EmActorStatus.CastAttackCharging: statusDuration = mySkill.curAttackConf.castTime; break; case EmActorStatus.CastAttack: statusDuration = PlayAnimation(EmActorAnimationName.CastAttack); break; case EmActorStatus.DoAttack: bool canSpeedUp = mySkill.skillID <= 100003 || mySkill.skillID == 100101; //就这么几个技能动作受加速影响 statusDuration = PlayAnimation(mySkill.curAttackConf.actorClipName, canSpeedUp); mySkill.DoCurAttack(); break; case EmActorStatus.BeAttackedFrozen: case EmActorStatus.BeAttackedHitMove: case EmActorStatus.BeAttackedHitMoveDist: case EmActorStatus.BeAttackedToss: if (objectbase.realLocalPos.y > STAND_ON_GROUND_THROLD) { PlayAnimation(damageConf.actorBeHitFlyInAirAnima); } else { PlayAnimation(damageConf.actorBeHitStandOnGroundAnima); } statusDuration = damageConf.hitMoveTime; break; case EmActorStatus.BeAttackedFallOff: PlayAnimation(EmActorAnimationName.BeAttackedFly); //横躺着"飞"下来 break; case EmActorStatus.BeAttackedLieOnGround: PlayAnimation(EmActorAnimationName.BeAttackedLieOnGround); statusDuration = SkillAttack.GetDamageDuration(damageConf); break; case EmActorStatus.BeAttackedFallDown: statusDuration = PlayAnimation(EmActorAnimationName.BeAttackedFallDown); break; case EmActorStatus.BeAttackedFreeze: PlayAnimation(EmActorAnimationName.BeAttacked); if (actorCurStatus != EmActorStatus.BeAttackedFreeze) { //如果当前正处于冰冻状态,则不用播 statusDuration = damageConf.damageStatusEffectDuration; freezeEffect = EffectManager.GetEffect(GameConfig.effect_Common_Freeze, transform); freezeEffect.effectObject.realLocalPos = new Vector3(0, -10, -10); freezeEffect.x2dEffect.Play(); } break; case EmActorStatus.BeAttackedMelt: PlayAnimation(EmActorAnimationName.BeAttacked); meltEffect = EffectManager.GetEffect(GameConfig.effect_Common_Melt, transform); meltEffect.x2dEffect.Play(); meltEffect.effectObject.realLocalPos = new Vector3(0, -10, -10); statusDuration = meltEffect.x2dEffect.duration; break; case EmActorStatus.BeAttackedStun: PlayAnimation(EmActorAnimationName.BeAttacked); if (actorCurStatus != EmActorStatus.BeAttackedStun) { statusDuration = damageConf.damageStatusEffectDuration; stunEffect = EffectManager.GetEffect(GameConfig.effect_Common_Stun, transform); stunEffect.effectObject.realLocalPos = new Vector3(0, 120, -10); stunEffect.x2dEffect.Play(); } break; case EmActorStatus.Parry: PlayAnimation(EmActorAnimationName.Parry); statusDuration = float.MaxValue; break; case EmActorStatus.ParryBeAttacked: statusDuration = PlayAnimation(EmActorAnimationName.ParryBeAttacked); break; case EmActorStatus.Die: if (actorType == EmActorType.MainPlayer) //主角尸体不消失,播放倒地动作 { statusDuration = 0.5f; PlayAnimation(EmActorAnimationName.BeAttackedFallDown); if (actorConf.actorID == 1001) { audioSource.clip = ResourceLoader.LoadCharactorSound("sm_die"); //先这样直接写死了 audioSource.Play(); } } else { statusDuration = 0.1f; } break; case EmActorStatus.Dead: statusDuration = float.MaxValue; if (actorType == EmActorType.MainPlayer) //主角尸体不消失 { ; } else { //尸体消失,炸裂 objectbase.x2dAnim.Stop(); EffectObject eo = EffectManager.GetEffect(GameConfig.effect_MonsterDie_1, transform); MonsterDieEffect mdf = eo.x2dEffect.GetComponent <MonsterDieEffect>(); eo.effectObject.realLocalPos = Vector3.zero; mdf.Play(eo); } GameMain.curSceneManager.ActorDead(this); break; } curStatus = s; }