Beispiel #1
0
        public void Update(bool isFast, float pastRound, int round)
        {
            recoverTime += pastRound * GameConstants.RoundRecoverAddon * ((round >= GameConstants.RoundRecoverDoubleRound) ? 2 : 1);
            var need = isFast ? GameConstants.DrawManaTimeFast : GameConstants.DrawManaTime;

            if (recoverTime >= need)
            {
                recoverTime -= need;
                AddManaData(EnergyGenerator.NextAimMana, 1);
                EnergyGenerator.UseMana();
                EnergyGenerator.Next(round);
            }
            if (ManaChanged != null)//todo 先ws下
            {
                ManaChanged();
            }
            SpikeManager.OnRound(pastRound);
            comboTime -= pastRound;
            if (comboTime <= 0)
            {
                comboTime = 0;
                CardManager.UpdateCardCombo();
            }
            if (CardManager.HeroSkillCd > 0)
            {
                CardManager.HeroSkillCd -= pastRound;
                if (HeroSkillChanged != null && CardManager.HeroSkillCd <= 0)
                {
                    HeroSkillChanged(true);
                }
            }
        }
Beispiel #2
0
 private void OnTriggerEnter2D(Collider2D other)
 {
     if (other.tag == "Token")
     {
         SpikeManager.IncrementPoints();
     }
 }
Beispiel #3
0
        public void DoSpell(LiveMonster target, ActiveCard card, Point location)
        {
            if (!BeforeUseCard(card, location))
            {
                return;
            }

            try
            {
                Spell spell = new Spell(card.CardId);
                spell.Addon = SpellEffectAddon;
                spell.UpgradeToLevel(card.Level);
                if (!card.IsHeroSkill)
                {
                    BattleManager.Instance.StatisticData.GetPlayer(IsLeft).SpellAdd++;
                }

                SpellAssistant.CheckSpellEffect(spell, IsLeft, target, location);

                if (SpikeManager.HasSpike("mirrorspell"))
                {
                    Rival.AddCard(null, card.CardId, card.Level);
                }
            }
            catch (Exception e)
            {
                NLog.Warn(e);
                BattleManager.Instance.FlowWordQueue.Add(new FlowWord("未知错误", location, 0, "Red", 26, 0, 0, 2, 15), false);
                return;
            }
            AfterUseCard(card);
            CardManager.DeleteCardAt(SelectId);
        }
Beispiel #4
0
    public virtual void Play()
    {
        overlay.SetActive(false);

        SpikeManager.StartTurn();

        StartCoroutine(SpawnToken(tokenSpawn.position));
    }
Beispiel #5
0
        private List <int[]> monsterAddonOnce = new List <int[]>();  //一次性的强化

        #endregion

        public Player(bool playerControl, bool isLeft)
        {
            IsLeft          = isLeft;
            IsAlive         = true;
            isPlayerControl = playerControl;
            CardManager     = new CardManager(this);
            EnergyGenerator = new EnergyGenerator();
            SpikeManager    = new SpikeManager(this);
            TrapHolder      = new TrapHolder(this);
            State           = new PlayerState();
        }
 // If it is after Reduce Risk Time then reduce retrace levels by 50%
 override protected bool ExcuteRuleLogic()
 {
     if (BotState.IsAfterReducedRiskTime)
     {
         if (BotState.OrdersPlaced && BotState.PositionsRemainOpen())
         {
             //Reduce all retrace limits
             SpikeManager.ReduceLevelsBy50Percent();
             ExecuteOnceOnly();
             return(true);
         }
     }
     return(false);
 }
Beispiel #7
0
 //If Spike retrace is greater than Level 2 but less than Level 3 set Fixed Trailing Stop
 override protected bool ExcuteRuleLogic()
 {
     if (BotState.OrdersPlaced && BotState.PositionsRemainOpen())
     {
         if (SpikeManager.IsRetraceBetweenLevel2AndLevel3())
         {
             //Activate Trailing Stop Losses
             FixedTrailingStop.activate();
             ExecuteOnceOnly();
             return(true);
         }
     }
     return(false);
 }
        //Set BreakEven SL if Spike has retraced between than retraceLevel1 and retraceLevel2
        override protected bool ExcuteRuleLogic()
        {
            if (BotState.OrdersPlaced && BotState.PositionsRemainOpen())
            {
                //Calculate spike retrace factor
                SpikeManager.CalculateRetraceFactor();

                if (SpikeManager.IsRetraceBetweenLevel1AndLevel2())
                {
                    StopLossManager.IsBreakEvenStopLossActive = true;
                    return(true);
                }
            }
            return(false);
        }
Beispiel #9
0
    private void Start()
    {
        if (Instance == null)
        {
            Instance = this;
        }
        else
        {
            Destroy(gameObject);
            return;
        }

        gameManager = GetComponent <GameManager>();

        pointsText     = pointsCanvas.GetComponentInChildren <Text>();
        pointParticles = pointsCanvas.GetComponentInChildren <ParticleSystem>();
    }
Beispiel #10
0
        // If it is after CloseTime and remaining pending orders have not been closed then close all pending orders
        override protected bool ExcuteRuleLogic()
        {
            if (BotState.OrdersPlaced && BotState.PositionsRemainOpen())
            {
                //Calculate spike retrace factor
                SpikeManager.CalculateRetraceFactor();

                if (SpikeManager.IsRetraceGreaterThanLevel3())
                {
                    if (BotState.LastProfitPositionClosePrice > 0)
                    {
                        StopLossManager.SetSLWithBufferForAllPositions(BotState.LastProfitPositionClosePrice);
                        return(true);
                    }
                }
            }
            return(false);
        }
        // If it is after CloseTime and remaining pending orders have not been closed then close all pending orders
        override protected bool ExcuteRuleLogic()
        {
            if (BotState.OrdersPlaced && BotState.PositionsRemainOpen())
            {
                //Calculate spike retrace factor
                SpikeManager.CalculateRetraceFactor();

                if (SpikeManager.IsRetraceGreaterThanLevel3())
                {
                    if (BotState.LastProfitPositionClosePrice > 0)
                    {
                        StopLossManager.ReduceHardSLBufferBy50Percent();
                        ExecuteOnceOnly();
                        return(true);
                    }
                }
            }
            return(false);
        }
        //If Spike retrace is greater than Level 1 but less than Level 2 set SL to last profit position entry price plus buffer
        override protected bool ExcuteRuleLogic()
        {
            if (BotState.OrdersPlaced && BotState.PositionsRemainOpen())
            {
                //Calculate spike retrace factor
                SpikeManager.CalculateRetraceFactor();

                //Set hard stop losses and activate Trail if Spike has retraced between than retraceLevel1 and retraceLevel2
                if (SpikeManager.IsRetraceBetweenLevel1AndLevel2())
                {
                    //If Hard SL has not been set yet
                    if (BotState.LastProfitPositionEntryPrice > 0)
                    {
                        StopLossManager.SetSLWithBufferForAllPositions(BotState.LastProfitPositionEntryPrice);
                        return(true);
                    }
                }
            }
            return(false);
        }
    // SingleExponentialEPSC synapseScript;

    // Start is called before the first frame update
    void Start()
    {
        if (this.neuronType == "IB")
        {
            this.C                = 150; this.a = 0.01; this.b = 5; this.k = 1.2; this.d = 130;
            this.vrest            = -75; this.vreset = -56; this.vthr = -45; this.vpeak = 50;
            this.currentInjection = 600;
        }
        else if (neuronType == "Chattering")
        {
            this.C                = 50; this.a = 0.03; this.b = 1; this.k = 1.5; this.d = 150;
            this.vrest            = -60; this.vreset = -40; this.vthr = -40; this.vpeak = 35;
            this.currentInjection = 300;
        }

        this.v  = this.vrest;
        this.v_ = this.v;
        this.u  = 0;

        this.mat = gameObject.GetComponent <MeshRenderer>().material;


        // 発火管制塔にスパイクを知らせるため
        spikeManager       = GameObject.Find("SpikeManager");
        spikeManagerScript = spikeManager.GetComponent <SpikeManager>();
        // 自身に入力するシナプスとその重みを取得
        this.connection_weight = spikeManagerScript.connection_weight[spikeManagerScript.neuronDict[gameObject.name]];
        // ProjectSettingsでSpikeManagerのStart()が先に実行されるようにした

        neuronNum = spikeManagerScript.neuronNum;

        // 自身に入っているシナプス後電流の合計を取得するため
        // this.synapseScript = gameObject.GetComponent<SingleExponentialEPSC>();

        // (16ニューロンのとき)5番目以降のニューロンの入力電流をゼロにする あとで消せる
        if (spikeManagerScript.neuronDict[gameObject.name] >= 4)
        {
            this.currentInjection = 0;
        }
    }
Beispiel #14
0
        public bool BeforeUseCard(ActiveCard selectCard, Point location)
        {
            AddMp(-selectCard.Mp);
            AddLp(-selectCard.Lp);
            AddPp(-selectCard.Pp);

            var rival = Rival as Player;

            if (rival.TrapHolder.CheckTrapOnUseCard(selectCard, location, rival))
            {
                return(false);
            }

            SpikeManager.OnUseCard(selectCard.CardType);
            BattleManager.Instance.MonsterQueue.OnPlayerUseCard(this, (int)selectCard.CardType, selectCard.Level);
            if (OnUseCard != null)
            {
                OnUseCard(selectCard.CardId, selectCard.Level, IsLeft);
            }

            return(true);
        }
Beispiel #15
0
 // Start is called before the first frame update
 void Start()
 {
     spikeManager = GameObject.FindGameObjectWithTag("GameManager").GetComponent <SpikeManager>();
 }
Beispiel #16
0
 public void RemoveSpike(int id)
 {
     SpikeManager.RemoveSpike(id);
 }
Beispiel #17
0
 public void AddSpike(int id)
 {
     SpikeManager.AddSpike(id);
 }
Beispiel #18
0
 private void OnCollisionEnter2D(Collision2D other)
 {
     GameObject.Destroy(other.gameObject);
     SpikeManager.FinishTurn();
 }